/* Media Cards */
.media-box {
position: relative;
display: inline-block;
max-width: min(100%, 360px);
border-radius: 12px;
overflow: hidden;
margin-top: 2px;
}

.msg-outgoing .media-box {
margin-left: auto;
margin-right: 0;
border-radius: 14px 14px 4px 14px;
}

.msg-incoming .media-box {
margin-left: 0;
margin-right: auto;
border-radius: 14px 14px 14px 4px;
}

.media-img {
max-width: 100%;
max-height: 280px;
border-radius: 12px;
display: block;
cursor: pointer;
transition: transform 0.25s ease, filter 0.25s ease;
}

.msg-outgoing .media-img {
border: 1.5px solid rgba(192, 132, 252, 0.5);
box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
border-radius: 14px 14px 4px 14px;
}

.msg-incoming .media-img {
border: 1.5px solid rgba(52, 211, 153, 0.6);
box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
border-radius: 14px 14px 14px 4px;
}

.media-img:hover {
transform: scale(1.015);
filter: brightness(1.05);
}

/* Discord / WhatsApp-style multi-file album */
.media-album {
display: grid;
gap: var(--album-gap, 3px);
width: 100%;
max-width: min(100%, var(--album-max-width, 360px));
margin-top: 2px;
overflow: hidden;
border-radius: 12px;
}

.msg-outgoing .media-album {
margin-left: auto;
margin-right: 0;
border-radius: 14px 14px 4px 14px;
}

.msg-incoming .media-album {
margin-left: 0;
margin-right: auto;
border-radius: 14px 14px 14px 4px;
}

.media-album[data-count="2"],
.media-album[data-count="4"],
.media-album[data-count="5"],
.media-album[data-count="6"],
.media-album[data-count="7"],
.media-album[data-count="8"],
.media-album[data-count="9"],
.media-album[data-count="10"] {
grid-template-columns: 1fr 1fr;
}

.media-album[data-count="3"] {
grid-template-columns: 1.15fr 1fr;
grid-template-rows: repeat(2, minmax(var(--album-cell-min, 92px), 140px));
}

.media-album[data-count="3"] .media-album-cell {
max-height: none;
min-height: 0;
height: 100%;
}

.media-album[data-count="3"] .media-album-cell:first-child {
grid-row: 1 / 3;
}

.media-album-cell {
position: relative;
overflow: hidden;
min-height: var(--album-cell-min, 92px);
max-height: var(--album-cell-max, 180px);
background: #000;
}

.media-album[data-count="2"] .media-album-cell {
min-height: 140px;
max-height: 220px;
}

.media-album-img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
cursor: pointer;
max-height: inherit;
}

.media-album-cell video.media-album-img {
cursor: default;
}

.msg-outgoing .media-album {
border: 1.5px solid rgba(192, 132, 252, 0.5);
box-shadow: 0 0 15px rgba(168, 85, 247, 0.25);
}

.msg-incoming .media-album {
border: 1.5px solid rgba(52, 211, 153, 0.6);
box-shadow: 0 0 20px rgba(16, 185, 129, 0.35);
}

.media-album-cell img:hover {
filter: brightness(1.08);
}

/* Ghost Waveform Audio Player */
.ghost-waveform-player {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 11px;
border-radius: 12px;
background: rgba(8, 4, 18, 0.92);
border: 1px solid rgba(168, 85, 247, 0.4);
box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
margin-top: 4px;
max-width: 360px;
user-select: none;
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.msg-outgoing .ghost-waveform-player {
margin-left: auto;
margin-right: 0;
border-radius: 14px 14px 4px 14px;
}

.msg-incoming .ghost-waveform-player {
margin-left: 0;
margin-right: auto;
border-radius: 14px 14px 14px 4px;
border-color: rgba(52, 211, 153, 0.5);
box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(52, 211, 153, 0.15);
}

.ghost-play-btn {
width: 30px;
height: 30px;
border-radius: 50%;
background: rgba(168, 85, 247, 0.2);
border: 1px solid rgba(168, 85, 247, 0.5);
color: #c084fc;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
outline: none;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
flex-shrink: 0;
}

.msg-incoming .ghost-play-btn {
background: rgba(52, 211, 153, 0.18);
border-color: rgba(52, 211, 153, 0.5);
color: #34d399;
}

.ghost-play-btn:hover {
transform: scale(1.08);
background: rgba(52, 211, 153, 0.3);
border-color: #34d399;
color: #34d399;
box-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
}

.ghost-play-btn.is-playing {
border-color: #34d399;
color: #34d399;
background: rgba(52, 211, 153, 0.25);
box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

.ghost-bars-track {
display: flex;
align-items: center;
gap: 2.5px;
height: 28px;
flex: 1;
cursor: pointer;
padding: 0 3px;
border-radius: 4px;
transition: background 0.15s ease;
}

.ghost-bars-track:hover {
background: rgba(255, 255, 255, 0.03);
}

.ghost-bar {
width: 3px;
border-radius: 9999px;
background: rgba(192, 132, 252, 0.32);
transition: height 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.msg-incoming .ghost-bar {
background: rgba(52, 211, 153, 0.28);
}

.ghost-bar.active {
background: linear-gradient(180deg, #34d399, #10b981);
box-shadow: 0 0 7px rgba(52, 211, 153, 0.85);
}

.ghost-bar.playing {
animation: bar-pulse 0.4s infinite alternate ease-in-out;
}

@keyframes bar-pulse {
0% { transform: scaleY(0.7); }
100% { transform: scaleY(1.3); }
}

.ghost-time {
font-size: 0.7rem;
font-family: ui-monospace, monospace;
color: rgba(216, 180, 254, 0.75);
font-weight: 600;
white-space: nowrap;
}

.msg-incoming .ghost-time {
color: rgba(110, 231, 183, 0.85);
}

.ghost-kind-badge {
font-size: 0.6rem;
font-family: ui-monospace, monospace;
font-weight: 700;
letter-spacing: 0.08em;
color: #34d399;
border: 1px solid rgba(52, 211, 153, 0.45);
background: rgba(52, 211, 153, 0.08);
border-radius: 9999px;
padding: 1px 6px;
flex-shrink: 0;
}

.msg-outgoing .ghost-kind-badge {
color: #c084fc;
border-color: rgba(192, 132, 252, 0.45);
background: rgba(192, 132, 252, 0.08);
}

.media-box.sticker-box .media-img {
max-height: 160px;
max-width: 160px;
cursor: pointer;
}

.media-box.video-note-box {
border-radius: 50%;
}

.media-box.video-note-box .media-img,
video.video-note {
width: 220px;
height: 220px;
max-height: 220px;
object-fit: cover;
border-radius: 50%;
}

/* Glowing Syntax-Highlighted Code Blocks */
.code-block-card {
margin: 6px 0;
border-radius: 10px;
background: rgba(6, 2, 14, 0.95);
border: 1px solid rgba(168, 85, 247, 0.4);
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
overflow: hidden;
max-width: 100%;
}

.code-block-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4px 10px;
background: rgba(18, 8, 38, 0.9);
border-bottom: 1px solid rgba(168, 85, 247, 0.25);
font-size: 0.7rem;
font-family: ui-monospace, monospace;
}

.code-lang-label {
color: #c084fc;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
}

.code-header-actions {
display: flex;
align-items: center;
gap: 5px;
}

.code-copy-btn,
.code-save-btn {
background: rgba(168, 85, 247, 0.15);
border: 1px solid rgba(168, 85, 247, 0.35);
border-radius: 4px;
color: #e9d5ff;
font-size: 0.68rem;
padding: 2px 6px;
cursor: pointer;
transition: all 0.2s;
}

.code-copy-btn:hover,
.code-save-btn:hover {
background: rgba(52, 211, 153, 0.25);
border-color: #34d399;
color: #34d399;
}

.code-content {
margin: 0;
padding: 10px 12px;
overflow-x: auto;
font-size: 0.85rem;
line-height: 1.45;
font-family: ui-monospace, Consolas, monospace;
color: #f3f4f6;
white-space: pre;
}

.tok-kw { color: #c084fc; font-weight: bold; text-shadow: 0 0 6px rgba(192, 132, 252, 0.5); }
.tok-str { color: #34d399; text-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.tok-num { color: #38bdf8; }
.tok-com { color: #6b7280; font-style: italic; }


/* ─── 3. Ghost Waveform Speed & Volume Multiplier Sliders & Popovers (#10) ─── */
.ghost-speed-wrapper,
.ghost-vol-wrapper {
position: relative;
display: inline-flex;
align-items: center;
flex-shrink: 0;
}

.ghost-speed-btn,
.ghost-vol-btn {
background: rgba(168, 85, 247, 0.18);
border: 1px solid rgba(168, 85, 247, 0.4);
border-radius: 6px;
color: #e9d5ff;
font-family: ui-monospace, monospace;
font-size: 0.68rem;
font-weight: 700;
padding: 2px 5px;
height: 24px;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
flex-shrink: 0;
user-select: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 2px;
}

.ghost-vol-btn {
width: 24px;
padding: 0;
}

.msg-incoming .ghost-speed-btn,
.msg-incoming .ghost-vol-btn {
background: rgba(52, 211, 153, 0.14);
border-color: rgba(52, 211, 153, 0.4);
color: #6ee7b7;
}

.ghost-speed-btn:hover,
.ghost-speed-btn.active,
.ghost-vol-btn:hover,
.ghost-vol-btn.active {
background: rgba(52, 211, 153, 0.3);
border-color: #34d399;
color: #34d399;
box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
transform: translateY(-0.5px);
}

.ghost-speed-popover,
.ghost-vol-popover {
position: absolute;
bottom: calc(100% + 8px);
left: 50%;
transform: translateX(-50%);
background: rgba(14, 8, 28, 0.96);
border: 1px solid rgba(168, 85, 247, 0.5);
border-radius: 8px;
padding: 8px 6px;
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 12px rgba(168, 85, 247, 0.3);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
z-index: 60;
user-select: none;
min-width: 44px;
}

.ghost-speed-popover.hidden,
.ghost-vol-popover.hidden {
display: none !important;
}

.msg-incoming .ghost-speed-popover,
.msg-incoming .ghost-vol-popover {
border-color: rgba(52, 211, 153, 0.5);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.85), 0 0 12px rgba(52, 211, 153, 0.3);
}

.ghost-speed-val-badge,
.ghost-vol-val-badge {
font-family: ui-monospace, monospace;
font-size: 0.7rem;
font-weight: 700;
color: #34d399;
text-shadow: 0 0 6px rgba(52, 211, 153, 0.8);
white-space: nowrap;
}

.ghost-speed-slider,
.ghost-vol-slider {
-webkit-appearance: slider-vertical;
writing-mode: vertical-lr;
direction: rtl;
width: 18px;
height: 90px;
cursor: pointer;
background: transparent;
accent-color: #34d399;
}

@keyframes msg-appear {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes pop-bounce {
0% { transform: scale(0.4); opacity: 0; }
70% { transform: scale(1.15); }
100% { transform: scale(1); opacity: 1; }
}

/* Day divider — visitor feed + admin thread */
.feed-day-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0.65rem 0 0.25rem 0;
  position: relative;
  user-select: none;
  pointer-events: none;
  transition: opacity 0.3s ease;
  animation: msg-appear 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.feed-day-divider::before,
.feed-day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.35), transparent);
}

.feed-day-divider-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  margin: 0 10px;
  border-radius: 9999px;
  background: rgba(18, 10, 36, 0.88);
  border: 1px solid rgba(168, 85, 247, 0.38);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 12px rgba(168, 85, 247, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #d8b4fe;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.4);
  text-transform: uppercase;
}

/* Quoted reply card */
.msg-quote-card {
display: flex;
flex-direction: column;
gap: 2px;
padding: 4px 8px;
margin-bottom: 6px;
border-radius: 6px;
background: rgba(0, 0, 0, 0.45);
border-left: 2.5px solid #34d399;
font-size: 0.76rem;
font-family: ui-monospace, monospace;
cursor: pointer;
transition: all 0.2s ease;
}
.msg-outgoing .msg-quote-card,
.chat-msg-row.incoming .msg-quote-card {
border-left-color: #c084fc;
}
.msg-quote-card:hover {
background: rgba(168, 85, 247, 0.2);
transform: translateX(2px);
}
.msg-quote-sender {
font-weight: 700;
color: #34d399;
font-size: 0.68rem;
}
.msg-outgoing .msg-quote-sender,
.chat-msg-row.incoming .msg-quote-sender {
color: #c084fc;
}
.msg-quote-text {
color: #cbd5e1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Links + OpenGraph / YouTube previews */
.neon-chat-link {
color: #34d399;
text-decoration: underline;
text-underline-offset: 3px;
font-weight: 500;
transition: all 0.2s ease;
word-break: break-all;
display: inline-flex;
align-items: center;
gap: 3px;
}
.neon-chat-link:hover {
color: #a7f3d0;
text-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.link-preview-container {
margin-top: 8px;
display: flex;
flex-direction: column;
gap: 8px;
}

.link-preview-card {
border-radius: 12px;
background: rgba(10, 5, 22, 0.92);
border: 1px solid rgba(168, 85, 247, 0.4);
border-left: 3px solid #34d399;
overflow: hidden;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(168, 85, 247, 0.15);
display: flex;
flex-direction: column;
text-decoration: none;
max-width: 480px;
transition: all 0.2s ease;
animation: msg-appear 0.25s ease-out;
user-select: none;
cursor: pointer;
}
.link-preview-card:hover {
border-color: #34d399;
box-shadow: 0 6px 25px rgba(0, 0, 0, 0.8), 0 0 20px rgba(52, 211, 153, 0.35);
transform: translateY(-2px);
}

.link-preview-img-box {
width: 100%;
max-height: 180px;
overflow: hidden;
background: #06020c;
display: flex;
align-items: center;
justify-content: center;
}
.link-preview-img {
width: 100%;
height: 100%;
max-height: 180px;
object-fit: cover;
transition: transform 0.3s ease;
}
.link-preview-card:hover .link-preview-img {
transform: scale(1.03);
}

.link-preview-content {
padding: 10px 14px;
display: flex;
flex-direction: column;
gap: 4px;
font-family: ui-monospace, monospace;
}
.link-preview-site {
font-size: 0.72rem;
color: #c084fc;
font-weight: 700;
display: flex;
align-items: center;
gap: 4px;
}
.link-preview-title {
font-size: 0.88rem;
font-weight: 700;
color: #ffffff;
line-height: 1.3;
}
.link-preview-desc {
font-size: 0.76rem;
color: rgba(226, 232, 240, 0.75);
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}

.youtube-embed-box {
margin-top: 8px;
border-radius: 12px;
overflow: hidden;
border: 1px solid rgba(168, 85, 247, 0.5);
max-width: 480px;
background: #000;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}
.youtube-embed-iframe {
width: 100%;
aspect-ratio: 16 / 9;
border: none;
display: block;
}

.direct-img-preview-card {
margin-top: 8px;
border-radius: 12px;
overflow: hidden;
border: 1px solid rgba(168, 85, 247, 0.5);
max-width: 480px;
background: rgba(8, 4, 18, 0.9);
cursor: pointer;
transition: all 0.2s ease;
position: relative;
}
.direct-img-preview-card:hover {
border-color: #34d399;
box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
transform: scale(1.01);
}
.direct-img-preview-img {
width: 100%;
max-height: 240px;
object-fit: contain;
display: block;
}

.neon-reaction-badge {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 0.82rem;
padding: 2px 8px;
border-radius: 9999px;
background: rgba(10, 5, 20, 0.94);
border: 1px solid rgba(168, 85, 247, 0.55);
box-shadow: 0 0 10px rgba(168, 85, 247, 0.3), 0 2px 8px rgba(0, 0, 0, 0.7);
color: #ffffff;
animation: pop-bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
user-select: none;
cursor: pointer;
transition: transform 0.15s ease, border-color 0.15s ease;
}
.neon-reaction-badge:hover {
transform: scale(1.18);
border-color: #c084fc;
box-shadow: 0 0 14px rgba(168, 85, 247, 0.55);
}
.neon-reaction-badge .react-count {
font-size: 0.72rem;
font-weight: 700;
opacity: 0.9;
margin-left: 1px;
}

.msg-chips-dock,
.msg-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 4px;
}

.neon-action-chip,
.msg-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: rgba(192, 132, 252, 0.08);
  border: 1px solid rgba(192, 132, 252, 0.35);
  color: #f3e8ff;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.neon-action-chip:hover:not(:disabled),
.msg-action-chip:hover {
  background: rgba(192, 132, 252, 0.22);
  border-color: #c084fc;
  color: #ffffff;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.45);
}

.neon-action-chip:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.neon-action-chip.chip-sent {
  background: rgba(52, 211, 153, 0.15);
  border-color: #34d399;
  color: #6ee7b7;
  cursor: default;
  transform: none !important;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.neon-action-chip:disabled:not(.chip-sent) {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.6);
}
