/* ============================================================
   RadioChat FM — Default Dark Radio Theme  v4
   Matches index.php v4 HTML structure
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg-base:        #0f0f13;
  --bg-panel:       #16161d;
  --bg-raised:      #1e1e28;
  --bg-input:       #1a1a24;
  --bg-hover:       #252535;
  --border:         #2a2a3a;
  --accent:         #e03040;
  --accent-dim:     #8b1a24;
  --accent-glow:    rgba(224,48,64,0.18);
  --accent-2:       #42a5f5;
  --text-primary:   #f0f0f4;
  --text-secondary: #a0a0b8;
  --text-muted:     #606078;
  --text-admin:     #ff7043;
  --text-mod:       #42a5f5;
  --online-dot:     #4caf50;
  --error:          #ff4455;
  --warn:           #ffb300;
  --radius:         6px;
  --radius-lg:      10px;
  --shadow:         0 4px 20px rgba(0,0,0,0.6);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --font-display:   'Segoe UI', system-ui, sans-serif;
  --sidebar-width:  200px;
  --header-bg:      #12121a;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-display);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a50; }

/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-base);
  padding: 20px;
  position: relative;
}
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
}
#login-screen[style*="background-image"]::before {
  display: block;
}
#login-screen > * {
  position: relative;
  z-index: 1;
}

#login-box {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: .5px;
}

.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.login-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.login-tab.active { color: var(--text-primary); background: var(--bg-hover); }
.login-tab:hover  { color: var(--text-primary); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
.field input, .field select, .field textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input[type=color] { height: 36px; padding: 3px 6px; cursor: pointer; }
.field textarea { resize: vertical; min-height: 70px; }

/* ══════════════════════════════════════════════════════════
   CHAT SCREEN LAYOUT
══════════════════════════════════════════════════════════ */
#chat-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* ── Header ───────────────────────────────────────────────── */
#chat-header {
  flex-shrink: 0;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

#header-inner {
  display: flex;
  flex-direction: column;
  padding: 4px 16px;
  height: 100%;
  justify-content: center;
  gap: 2px;
}

/* Top row: logo + onair + actions */
#header-top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

#header-logo-link, #station-name-link { text-decoration: none; flex-shrink: 0; }

#header-logo {
  height: 42px;
  max-height: 42px;
  max-width: 160px;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
}

#header-station-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
  white-space: nowrap;
}

#onair-image-wrap { display: flex; align-items: center; flex-shrink: 0; }
#onair-img { height: 32px; max-width: 120px; width: auto; object-fit: contain; }

/* Ticker row: below logo */
#header-ticker {
  flex: 1;
  overflow: hidden;
  height: 32px;
  display: flex;
  align-items: center;
  width: 100%;
}

#ticker-iframe { border: none; width: 100%; height: 100%; }

#ticker-text {
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

#ticker-content {
  display: inline-block;
  animation: ticker-scroll 30s linear infinite;
  font-size: 13px;
  color: var(--text-secondary);
}
@keyframes ticker-scroll {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Banners ──────────────────────────────────────────────── */
#banner-bar {
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.banner-ad {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 4px 0;
  text-decoration: none;
  color: var(--text-secondary);
  border-right: 1px solid var(--border);
  font-size: 12px;
  min-height: 28px;
}
.banner-ad:last-child { border-right: none; }
.banner-ad.banner-img { padding: 0; justify-content: center; }
.banner-ad.banner-img img { height: 100%; width: auto; object-fit: contain; max-height: 40px; }

.banner-marquee {
  display: inline-block;
  white-space: nowrap;
  animation: ticker-scroll 20s linear infinite;
  padding-left: 12px;
}

/* ── Pinned Bar (sticky above messages) ──────────────────── */
#pinned-bar {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 4px 10px;
  flex-shrink: 0;
}

.pinned-msg {
  display: block;
  position: relative;
  font-size: 14px;
  color: var(--text-primary);
  padding: 4px 28px 4px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: var(--radius);
  margin: 2px 0;
  cursor: pointer;
  word-break: break-word;
  line-height: 1.6;
}
.pin-icon { font-size: 13px; }
.pin-user { color: var(--text-secondary); font-size: 14px; font-weight: 700; }
.pin-content {
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pinned-msg.expanded .pin-content { -webkit-line-clamp: unset; overflow: visible; display: inline; }
.pin-expand-hint { font-size: 10px; color: var(--text-muted); }
.pin-unpin-btn {
  position: absolute;
  top: 4px; right: 4px;
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 13px; padding: 0 3px; line-height: 1;
}
.pin-unpin-btn:hover { color: var(--error); }

/* ── Chat Body ────────────────────────────────────────────── */
#chat-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

#chat-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}

#chat-main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-base);
}

/* Room background — make all children transparent */
#chat-screen.has-room-bg #chat-body,
#chat-screen.has-room-bg #chat-column,
#chat-screen.has-room-bg #chat-main {
  background-color: transparent !important;
}
#chat-screen.has-room-bg .msg-username,
#chat-screen.has-room-bg .msg-content,
#chat-screen.has-room-bg .msg-emojis,
#chat-screen.has-room-bg .msg-colon,
#chat-screen.has-room-bg .msg-time {
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
}
#chat-screen.has-room-bg .msg-row {
  background: transparent;
}
#chat-screen.has-room-bg .msg-row:hover {
  background: rgba(0,0,0,0.2);
}

#messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
}

/* ── User List ────────────────────────────────────────────── */
#user-list-panel {
  width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#albumart-wrap {
  flex-shrink: 0;
  width: 100%;
  overflow: hidden;
  position: relative;
}

#albumArt {
  width: 100%;
  height: auto;
  max-height: var(--sidebar-width);
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
}

#user-list-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#online-count {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  flex: 1;
}

#room-mode-badge { flex-shrink: 0; }

#user-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  transition: background .1s;
  cursor: default;
}
.user-row:hover { background: var(--bg-hover); }
.user-row.user-away { opacity: .55; }

.online-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--online-dot);
  box-shadow: 0 0 4px var(--online-dot);
  flex-shrink: 0;
}
.online-dot.away { background: var(--warn); box-shadow: none; }

.user-emoji { font-size: 14px; flex-shrink: 0; }

.user-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.user-name:hover { text-decoration: underline; }

.user-profile-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; opacity: 0; padding: 0 2px;
  transition: opacity .15s; color: var(--text-muted);
  flex-shrink: 0;
}
.user-row:hover .user-profile-btn { opacity: 1; }
.user-profile-btn:hover { color: var(--text-primary); }

/* ── Input Area ───────────────────────────────────────────── */
#chat-input-area {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 8px 12px;
  flex-shrink: 0;
}

#input-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

#room-selector-wrap { margin-right: 4px; }

#room-selector {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
}
#room-selector:focus { border-color: var(--accent); }

.toolbar-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  padding: 5px 9px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1;
}
.toolbar-btn:hover  { background: var(--bg-hover); color: var(--text-primary); }
.toolbar-btn.active { background: var(--accent-dim); color: var(--text-primary); border-color: var(--accent); }

#visible-to {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
}
#visible-to:focus { border-color: var(--accent); }

#quote-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
#quote-bar button {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 0; line-height: 1;
}
#quote-bar button:hover { color: var(--error); }
#quote-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

#msg-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  padding: 8px 12px;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color .15s;
}
#msg-input:focus { border-color: var(--accent); }
#msg-input::placeholder { color: var(--text-muted); }

/* ── Footer ───────────────────────────────────────────────── */
#chat-footer {
  flex-shrink: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  overflow: hidden;
}

#footer-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 100%;
}

#player-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#play-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 30px; height: 30px;
  font-size: 12px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
#play-btn:hover { background: #c0202e; transform: scale(1.1); }

#player-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

#vol-slider {
  width: 70px;
  accent-color: var(--accent);
  cursor: pointer;
}

#vol-icon { font-size: 14px; }

#footer-hint {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* ══════════════════════════════════════════════════════════
   MESSAGES
══════════════════════════════════════════════════════════ */
.msg-row {
  display: flex;
  gap: 8px;
  padding: 4px 6px;
  border-radius: var(--radius);
  transition: background .1s;
}
.msg-row:hover { background: var(--bg-hover); }

.msg-body { flex: 1; min-width: 0; }

.msg-quote {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 4px 8px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: fit-content;
  max-width: 100%;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
}

.msg-line {
  display: block;
  line-height: 1.6;
  word-break: break-word;
}

.msg-prefix {
  display: inline;
  white-space: nowrap;
}

.msg-emojis { font-size: 14px; line-height: 1; }

.msg-username {
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.msg-username:hover { text-decoration: underline; }

.msg-colon {
  font-weight: 700;
  font-size: 13px;
  margin-right: 4px;
}

.vis-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(224,48,64,.12);
  color: var(--accent);
  border: 1px solid rgba(224,48,64,.3);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  white-space: nowrap;
}

.msg-actions {
  display: none;
  align-items: center;
  gap: 2px;
  float: right;
}
.msg-row:hover .msg-actions { display: flex; }

.msg-action-btn {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius);
  color: var(--text-muted);
  opacity: .7;
  transition: opacity .15s, background .15s;
}
.msg-action-btn:hover { opacity: 1; background: var(--bg-raised); }

.msg-content {
  display: inline;
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.6;
}

.chat-emoji {
  max-height: 100px;
  max-width: 200px;
  height: auto;
  width: auto;
  vertical-align: middle;
  margin: 0 2px;
  border-radius: 3px;
}

.sound-cue {
  font-size: 12px;
  color: var(--text-mod);
  background: rgba(66,165,245,.08);
  border: 1px solid rgba(66,165,245,.2);
  border-radius: 3px;
  padding: 1px 6px;
}

.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-btn {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background .15s, border-color .15s;
}
.reaction-btn:hover { background: var(--bg-hover); border-color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  letter-spacing: .3px;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: #c0202e; }

.btn-ghost {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  transition: background .15s, color .15s;
  line-height: 1;
  position: relative;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════
   CONTEXT MENU
══════════════════════════════════════════════════════════ */
.ctx-menu {
  position: fixed;
  z-index: 9000;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px 0;
  min-width: 150px;
  display: none;
}
.ctx-menu.open { display: block; }

.ctx-header {
  padding: 6px 14px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.ctx-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .1s, color .1s;
  font-family: inherit;
}
.ctx-menu button:hover { background: var(--bg-hover); color: var(--text-primary); }

.ctx-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ══════════════════════════════════════════════════════════
   EMOJI PICKER
══════════════════════════════════════════════════════════ */
#emoji-picker {
  position: fixed;
  bottom: 140px;
  left: 12px;
  z-index: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 10px;
  width: 280px;
  max-height: 220px;
  overflow-y: auto;
}

#emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.emoji-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 20px;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, border-color .1s;
}
.emoji-btn:hover { background: var(--bg-hover); border-color: var(--border); }

/* ── Custom Emoji Picker ──────────────────────────────────── */
#cep-panel {
  position: fixed;
  bottom: 140px;
  left: 12px;
  z-index: 500;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 300px;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#cep-search-bar {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#cep-search {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  font-family: inherit;
}
#cep-search:focus { border-color: var(--accent); }

#cep-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.cep-item {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 3px;
  transition: background .1s, border-color .1s;
  display: flex; align-items: center; justify-content: center;
}
.cep-item:hover { background: var(--bg-hover); border-color: var(--border); }
.cep-item img { width: 60px; height: 60px; object-fit: contain; display: block; border-radius: 3px; }

/* ══════════════════════════════════════════════════════════
   PROFILE CARD
══════════════════════════════════════════════════════════ */
#profile-card {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  z-index: 8000;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 280px;
  padding: 20px;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

#profile-card-close {
  position: absolute;
  top: 10px; right: 10px;
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 2px 6px;
  border-radius: var(--radius);
}
#profile-card-close:hover { background: var(--bg-hover); color: var(--text-primary); }

#pc-avatar-wrap { margin-bottom: 4px; }

#pc-avatar {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
}

#pc-name { font-size: 16px; font-weight: 700; }
#pc-role { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
#pc-bio  { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
#pc-meta { font-size: 11px; color: var(--text-muted); }
#pc-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* ══════════════════════════════════════════════════════════
   DM WINDOW
══════════════════════════════════════════════════════════ */
#dm-window {
  position: fixed;
  bottom: 100px; right: 16px;
  z-index: 7000;
  width: 300px;
  max-height: 420px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#dm-window.open { display: flex; }

#dm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}

#dm-search-bar {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#dm-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  font-family: inherit;
}

#dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#dm-contacts {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

#dm-contacts .dm-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

#dm-contacts .dm-contact-item:hover {
  background: var(--bg-panel);
}

#dm-contacts .dm-contact-name {
  font-weight: 600;
  font-size: 13px;
}

#dm-contacts .dm-contact-preview {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

#dm-contacts .dm-unread-dot {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 5px;
}

.dm-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 85%;
  align-self: flex-start;
}
.dm-msg.dm-mine { align-self: flex-end; text-align: right; }

.dm-sender { font-size: 11px; color: var(--text-muted); font-weight: 700; }
.dm-content {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-primary);
  word-break: break-word;
}
.dm-msg.dm-mine .dm-content { background: var(--accent-dim); border-color: var(--accent); }
.dm-time { font-size: 10px; color: var(--text-muted); }

.dm-edit-btn {
  background: none; border: none; font-size: 11px;
  cursor: pointer; color: var(--text-muted); padding: 0;
}
.dm-edit-btn:hover { color: var(--text-primary); }

#dm-input-row {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#dm-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  font-family: inherit;
}
#dm-input:focus { border-color: var(--accent); }

/* ── DM Badge ─────────────────────────────────────────────── */
.dm-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.dm-badge.visible { display: flex; }

/* ══════════════════════════════════════════════════════════
   ROOM MODE BADGES
══════════════════════════════════════════════════════════ */
.party-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(255,193,7,.12); color: #ffc107;
  border: 1px solid rgba(255,193,7,.3);
  animation: party-pulse 1.5s ease-in-out infinite;
}
.quiet-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(66,165,245,.1); color: #42a5f5;
  border: 1px solid rgba(66,165,245,.3);
}
.locked-badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(255,68,85,.1); color: var(--error);
  border: 1px solid rgba(255,68,85,.3);
}

/* ── Party Mode ───────────────────────────────────────────── */
.party-mode #chat-main {
  animation: party-bg 3s ease-in-out infinite;
}
.party-mode #chat-body {
  border: 3px solid transparent;
  animation: party-border 2s linear infinite;
  border-radius: var(--radius);
}

@keyframes party-bg {
  0%, 100% { background: var(--bg-base); }
  50%       { background: #12101a; }
}
@keyframes party-border {
  0%   { border-color: #ff4444; }
  14%  { border-color: #ff8800; }
  28%  { border-color: #ffee00; }
  42%  { border-color: #44ff44; }
  57%  { border-color: #00ccff; }
  71%  { border-color: #8844ff; }
  85%  { border-color: #ff44cc; }
  100% { border-color: #ff4444; }
}
@keyframes party-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .7; transform: scale(1.05); }
}

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
#toast-wrap {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
  white-space: nowrap;
}
.toast-success { border-color: var(--online-dot); color: var(--online-dot); }
.toast-error   { border-color: var(--error);      color: var(--error); }
.toast-info    { border-color: var(--accent);      color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   RC TABLE (shared)
══════════════════════════════════════════════════════════ */
.rc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rc-table th {
  text-align: left; padding: 7px 10px;
  background: var(--bg-raised); color: var(--text-muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.rc-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rc-table tr:last-child td { border-bottom: none; }
.rc-table tr:hover td { background: var(--bg-hover); }

/* ── Room Welcome Message ─────────────────────────────────── */
.system-msg {
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
  padding: 4px 10px;
  margin: 2px 0;
  border-radius: var(--radius);
  background: color-mix(in srgb, currentColor 10%, transparent);
  border: 1px solid currentColor;
  opacity: 0.85;
  width: fit-content;
}

/* ── Ad Messages ─────────────────────────────────────────────── */
.ad-row {
  display: flex;
  padding: 2px 6px;
}
.ad-msg {
  align-self: flex-start;
  max-width: 80%;
  padding: 5px 10px;
  font-size: 13px;
  font-style: italic;
  border: 2px solid #ffffff44;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-raised));
  word-break: break-word;
}
.ad-msg.ad-flash {
  animation: adFlash 1s infinite;
}
@keyframes adFlash {
  0%, 100% { border-color: var(--ad-color1, #ffffff); box-shadow: 0 0 6px var(--ad-color1, #ffffff); }
  50%       { border-color: var(--ad-color2, #444444); box-shadow: 0 0 6px var(--ad-color2, #444444); }
}
.ad-msg img {
  display: block;
  max-width: 100%;
}
.ad-msg a { color: var(--accent); text-decoration: none; }
.ad-msg a:hover { text-decoration: underline; }

.room-welcome-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.room-welcome-inner {
  background: color-mix(in srgb, var(--bg-base) 50%, transparent);
  border: 3px double var(--accent);
  outline: 3px double color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 4px;
  border-radius: calc(var(--radius) * 2);
  padding: 32px 48px;
  text-align: center;
  max-width: 480px;
  transform: scale(0.3);
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.room-welcome-overlay.visible .room-welcome-inner {
  transform: scale(1);
}
.room-welcome-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: .02em;
}
.room-welcome-text {
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   MOBILE — 600px and below
══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Fix viewport height on mobile browsers ─────────────── */
  html, body {
    height: 100%;
    overflow: hidden;
  }
  #chat-screen {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    background-attachment: scroll !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #chat-header   { flex-shrink: 0; }
  #banner-bar    { flex-shrink: 0; }
  #pinned-bar    { flex-shrink: 0; }
  #chat-body     { flex: 1; min-height: 0; overflow: hidden; }
  #chat-input-area { flex-shrink: 0; }
  #chat-footer   { flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .hbm-section {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--text-muted);
    padding: 10px 16px 4px;
  }
  .hbm-item {
    display: block; width: 100%; text-align: left;
    padding: 11px 16px; background: none; border: none;
    color: var(--text-primary); font-size: 14px; cursor: pointer;
    transition: background .12s;
  }
  .hbm-item:hover, .hbm-item:active { background: var(--bg-hover); }
  .hbm-item.hbm-active { color: var(--accent); font-weight: 700; }
  .hbm-danger { color: var(--error) !important; }
  .hbm-divider { height: 1px; background: var(--border); margin: 6px 0; }

  /* ── Pinned messages — tap to expand on mobile ───────────── */
  .pinned-msg        { cursor: pointer; }
  .pin-expand-hint   { display: inline; }
  #emoji-toggle-btn  { display: none !important; }
  #hbm-emoji-btn     { display: none !important; }

  /* ── Hide room selector from toolbar (use hamburger) ─────── */
  #room-selector     { display: none !important; }

  /* ── User list — hide dot, personal emoji, count ────────── */
  .online-dot        { display: none !important; }
  .user-emoji        { display: none !important; }
  .user-role-emoji   { display: inline !important; }
  #online-count      { display: none !important; }

  /* ── Hide volume and send on mobile ─────────────────────── */
  #vol-slider        { display: none; }
  #mute-btn          { display: none; }
  #send-btn          { display: none; }

  /* ── Fix hamburger menu scrolling ───────────────────────── */
  #hamburger-menu {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
    max-height: 100vh !important;
    max-height: -webkit-fill-available !important;
    padding-bottom: env(safe-area-inset-bottom, 20px) !important;
  }
  #hamburger-menu > div:last-child {
    padding-bottom: 80px;
  }

  /* ── Header — logo left, hamburger right ────────────────── */
  #header-inner      { padding: 6px 10px; }
  #header-top-row    { justify-content: space-between; }
  #header-logo       { height: 32px; width: auto; display: block !important; }
  #header-station-name { font-size: 13px; }
  #onair-image-wrap  { display: none; }

  /* Show hamburger, hide individual buttons — but keep DM button always visible */
  #btn-hamburger     { display: flex !important; font-size: 22px; padding: 4px 8px; }
  #btn-profile,
  #btn-admin,
  #btn-logout,
  #btn-users-mobile  { display: none !important; }
  #dm-btn            { display: flex !important; }

  /* ── Ticker — full width ────────────────────────────────── */
  #header-ticker     { display: block !important; }

  /* ── Chat body — side by side ───────────────────────────── */
  #chat-body         { flex-direction: row; }

  /* ── User list — 30% width, show names ──────────────────── */
  #user-list-panel   {
    position: relative !important;
    transform: none !important;
    width: 30% !important;
    min-width: 80px !important;
    max-width: 30% !important;
    font-size: 11px;
  }
  #albumart-wrap     { display: none; }
  .user-item         { padding: 4px 4px; gap: 3px; flex-wrap: nowrap; }
  .user-avatar       { width: 18px; height: 18px; flex-shrink: 0; }
  .user-name         { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block !important; }
  .user-role-badge,
  .user-away-badge   { display: none; }

  /* ── Input area — always visible ────────────────────────── */
  #chat-input-area   { padding: 4px 6px; flex-shrink: 0; }
  #input-toolbar     { display: flex !important; gap: 2px; flex-wrap: wrap; }
  #room-selector     { font-size: 11px; padding: 3px 4px; max-width: 80px; }
  .toolbar-btn       { font-size: 13px; padding: 4px 6px; }
  #visible-to        { font-size: 11px; padding: 3px 4px; }
  #msg-input         { font-size: 14px; }

  /* ── Footer — play/pause, volume, history only ──────────── */
  #footer-inner      { padding: 0 8px; gap: 6px; flex-shrink: 0; }
  #footer-hint       { display: none; }
  #footer-inner > a  { display: none; }
  #station-select,
  #player-label,
  #stream-dot        { display: none; }
  #vol-slider        { width: 70px; }

  /* ── Messages ───────────────────────────────────────────── */
  #chat-main         { padding: 4px 6px; }
  .msg-content       { font-size: 13px; }
  .msg-time          { display: none; }

  /* ── DM window — full screen ────────────────────────────── */
  #dm-window {
    position: fixed; inset: 0;
    width: 100%; max-height: 100%;
    border-radius: 0;
  }

  /* ── Profile card ────────────────────────────────────────── */
  #profile-card      { width: 90vw; }

  /* ── Login box ───────────────────────────────────────────── */
  #login-box         { padding: 24px 16px; }

  /* ── Room list ───────────────────────────────────────────── */
  #room-list-screen  { padding: 20px 12px 80px; }

  /* ── History modal ───────────────────────────────────────── */
  #history-modal {
    width: 95vw !important;
    left: 2.5vw !important;
    top: 5vh !important;
  }
  #history-modal-body { height: 70vh; }

  /* ── Popups — bottom sheet ───────────────────────────────── */
  #emoji-picker, #cep-panel {
    left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 50vh;
  }

}

/* ── Holiday Effects — make chat area transparent so canvas shows through ── */
#chat-screen.holiday-active #chat-main {
  background-color: transparent !important;
}
#chat-screen.holiday-active #chat-column {
  background-color: transparent !important;
}
