/* ═══════════════════════════════════════════════════════════
   shared.css — Trivialabs Unified Design System
   Tetris-Effect inspired: dark navy · neon green · gold glow
   ═══════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ──────────────────────────────────────── */
:root {
  /* Backgrounds — deep space navy */
  --bg:             #020817;
  --bg2:            #0a0e1f;
  --jep-bg:         #020817;

  /* Board cell glass */
  --jep-panel:      rgba(8,18,55,0.80);
  --jep-revealed:   rgba(0,0,0,0.70);
  --jep-blue:       rgba(12,25,70,0.58);
  --jep-blue-hover: rgba(20,40,100,0.82);
  --jep-border:     rgba(255,255,255,0.11);
  --jep-border-hover: rgba(87,242,135,0.35);

  /* Glass surfaces */
  --glass:          rgba(255,255,255,0.025);
  --glass2:         rgba(255,255,255,0.055);
  --glass-border:   rgba(255,255,255,0.09);
  --card:           rgba(4,12,38,0.95);

  /* Brand / accent */
  --accent:         #5865F2;
  --accent2:        #4752c4;
  --accent-glow:    rgba(88,101,242,0.35);

  /* Colour palette */
  --green:          #57F287;
  --green-glow:     rgba(87,242,135,0.45);
  --red:            #ED4245;
  --buzz-red:       #c00000;
  --buzz-red-glow:  rgba(200,0,0,0.4);
  --yellow:         #57F287;
  --gold:           #57F287;
  --gold-glow:      rgba(87,242,135,0.45);
  --gold-dim:       #3dd470;
  /* No cyan — use green instead */
  --cyan:           rgba(8,18,55,0.8);

  /* Jeopardy aliases */
  --jep-gold:       #57F287;
  --jep-gold-dark:  #3dd470;

  /* Text */
  --text:           #dde3f0;
  --text2:          #5f6b84;
  --white:          #ffffff;

  /* Legacy aliases */
  --jp-bg:          #020817;
  --jp-dark:        rgba(12,25,70,0.58);
  --jp-darker:      rgba(0,0,0,0.70);
  --jp-header-bg:   rgba(8,18,55,0.80);

  /* Layout */
  --topbar-height:  50px;
  --sidebar-width:  290px;
  --topbar-bg:      rgba(2,8,23,0.98);
  --sidebar-bg:     rgba(2,8,23,0.97);
}

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

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

/* ── BLOB BACKGROUND ────────────────────────────────────── */
.bg-blobs {
  position: fixed; inset: 0; z-index: 0;
  overflow: hidden; pointer-events: none;
}
.bg-blobs::before {
  content: ''; position: absolute;
  width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, rgba(12,25,100,.12) 0%, transparent 70%);
  top: -200px; left: -200px;
  animation: blobFloat 20s ease-in-out infinite alternate;
}
.bg-blobs::after {
  content: ''; position: absolute;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(8,18,70,.10) 0%, transparent 70%);
  bottom: -150px; right: -100px;
  animation: blobFloat 26s ease-in-out infinite alternate-reverse;
}

/* ── KEYFRAMES ──────────────────────────────────────────── */
@keyframes blobFloat {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(60px,40px) scale(1.06); }
  100% { transform: translate(110px,80px) scale(0.97); }
}
@keyframes fadeSlideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes cardAppear {
  from { transform: translateY(60px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}
@keyframes slideUpIn {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  0%, 100% { text-shadow: 0 0 16px var(--green-glow), 0 0 40px rgba(87,242,135,.2); }
  50%      { text-shadow: 0 0 28px var(--green-glow), 0 0 60px rgba(87,242,135,.4); }
}
@keyframes goldGlow {
  0%, 100% { text-shadow: 0 0 12px var(--green-glow); }
  50%      { text-shadow: 0 0 28px var(--green-glow), 0 0 50px rgba(87,242,135,.2); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,0,0,.6), 0 8px 32px rgba(255,0,0,.4); }
  50%      { box-shadow: 0 0 0 18px rgba(255,0,0,0), 0 8px 32px rgba(255,0,0,.4); }
}
@keyframes cellAppear {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── GLASS CARD ─────────────────────────────────────────── */
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-sm   { padding: 6px 12px; font-size: 12px; }
.btn-icon {
  padding: 7px; border-radius: 6px;
  background: var(--glass2); border: 1px solid var(--glass-border);
  color: var(--text); cursor: pointer; transition: all .2s;
  font-size: 14px; line-height: 1;
}
.btn-icon:hover { background: rgba(255,255,255,.14); }

/* ── GREEN PULSE ANIMATIONS ──────────────────────────────── */
@keyframes btnGreenPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(87,242,135,0); border-color: rgba(87,242,135,0.40); }
  50%      { box-shadow: 0 0 14px rgba(87,242,135,0.28); border-color: rgba(87,242,135,0.70); }
}
@keyframes btnGoldPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,215,0,0); border-color: rgba(255,215,0,0.40); }
  50%      { box-shadow: 0 0 14px rgba(255,215,0,0.25); border-color: rgba(255,215,0,0.70); }
}

.btn-primary, .btn-accent {
  background: rgba(87,242,135,0.10);
  border: 1px solid rgba(87,242,135,0.40);
  color: #57F287;
  font-weight: 800;
  animation: btnGreenPulse 2.5s ease-in-out infinite;
}
.btn-primary:hover, .btn-accent:hover {
  background: rgba(87,242,135,0.22);
  border-color: rgba(87,242,135,0.80);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(87,242,135,0.25);
  animation: none;
}
.btn-ghost {
  background: var(--glass2); border: 1px solid var(--glass-border); color: var(--text);
}
.btn-ghost:hover { background: rgba(255,255,255,.12); border-color: rgba(87,242,135,0.25); color: #57F287; }

.btn-gold {
  background: rgba(87,242,135,0.10);
  border: 1px solid rgba(87,242,135,0.40);
  color: var(--green);
  font-weight: 800;
  animation: btnGreenPulse 2.5s ease-in-out infinite;
}
.btn-gold:hover {
  background: rgba(87,242,135,0.22);
  border-color: rgba(87,242,135,0.80);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(87,242,135,0.22);
  animation: none;
}
.btn-green {
  background: rgba(87,242,135,0.14);
  border: 1px solid rgba(87,242,135,0.45);
  color: #57F287;
  font-weight: 700;
  animation: btnGreenPulse 2.5s ease-in-out infinite;
}
.btn-green:hover { background: rgba(87,242,135,0.28); border-color: rgba(87,242,135,0.8); transform: translateY(-1px); animation: none; }

.btn-red { background: rgba(237,66,69,0.18); border: 1px solid rgba(237,66,69,0.45); color: var(--red); }
.btn-red:hover { background: rgba(237,66,69,0.28); filter: brightness(1.1); }

.btn-ai { background: linear-gradient(135deg, rgba(106,17,203,0.4), rgba(37,117,252,0.4)); border: 1px solid rgba(106,17,203,0.5); color: #c4aaff; }
.btn-ai:hover { opacity: 0.85; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════════
   INPUTS
   ══════════════════════════════════════════════════════════ */
input[type="text"], input[type="number"], textarea {
  background: var(--glass2);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder,
input[type="number"]::placeholder { color: var(--text2); }
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
textarea { resize: vertical; min-height: 80px; }
label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px;
}

/* ══════════════════════════════════════════════════════════
   TOPBAR (shared base)
   ══════════════════════════════════════════════════════════ */
.board-topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 16px;
  gap: 10px;
  background: var(--topbar-bg);
  border-bottom: 1px solid rgba(87,242,135,0.12);
  z-index: 10;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-radius: 0;
  border-left: none; border-right: none; border-top: none;
  box-shadow: 0 2px 20px rgba(0,0,0,0.4), 0 1px 0 rgba(87,242,135,0.06);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.board-topbar::-webkit-scrollbar { display: none; }

/* ── BRAND / LOGO ───────────────────────────────────────── */
.trivialabs-brand, .topbar-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px !important;
  letter-spacing: 0.18em;
  flex-shrink: 0;
  background: linear-gradient(130deg, #57F287 0%, #b0ffe8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(87,242,135,0.55)) drop-shadow(0 0 24px rgba(255,215,0,0.2));
  user-select: none;
}
.topbar-divider {
  width: 1px; height: 22px; flex-shrink: 0;
  background: rgba(255,255,255,0.1);
}
.topbar-group {
  display: flex; align-items: center; gap: 5px; flex-shrink: 0;
}

/* ── ONLINE BADGE ───────────────────────────────────────── */
.online-badge, #host-online-count, #online-count {
  font-size: 11px;
  color: var(--text2);
  white-space: nowrap;
  padding: 3px 8px;
  background: var(--glass2);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
}

/* ── LANGUAGE TOGGLE ────────────────────────────────────── */
.lang-toggle {
  display: flex; gap: 3px;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 8px; padding: 2px; flex-shrink: 0;
}
.lang-btn {
  background: none; border: none; color: var(--text2);
  cursor: pointer; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 700; transition: all .2s;
}
.lang-btn:hover { background: var(--glass2); color: var(--text); }
.lang-btn.active { background: rgba(87,242,135,0.16); color: #57F287; border-radius: 6px; box-shadow: 0 0 8px rgba(87,242,135,0.2); }

/* ══════════════════════════════════════════════════════════
   SIDEBAR (shared base — host + player)
   ══════════════════════════════════════════════════════════ */
.board-sidebar, .host-side-panel {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  background: rgba(2,8,23,0.97);
  border-left: 1px solid rgba(87,242,135,0.12);
  backdrop-filter: blur(20px);
  scrollbar-width: thin;
  scrollbar-color: rgba(87,242,135,0.2) transparent;
}

/* Scrollable area inside sidebar — wraps all content above chat */
.sidebar-scroll-area {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(87,242,135,0.2) transparent;
}

/* ── SIDEBAR SECTION LABEL ──────────────────────────────── */
.sidebar-label, .panel-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text2);
  text-transform: uppercase;
  padding: 10px 12px 5px;
  flex-shrink: 0;
}

.sidebar-section, .side-section {
  border-top: 1px solid var(--glass-border);
}

/* ── ROOM CODE BOX ──────────────────────────────────────── */
.room-code-box {
  margin: 4px 10px 8px;
  padding: 10px 14px;
  background: var(--glass2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  text-align: center;
}
.room-code-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--text2); text-transform: uppercase; margin-bottom: 4px;
}
.room-code-value {
  font-size: 26px; font-weight: 900; color: var(--green);
  letter-spacing: 8px; font-family: 'Bebas Neue', sans-serif;
  text-shadow: 0 0 20px var(--green-glow);
  animation: goldGlow 3s ease-in-out infinite;
}
.room-code-actions {
  display: flex; gap: 6px; justify-content: center; margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════
   CHAT PANEL (shared — host + player)
   ══════════════════════════════════════════════════════════ */
#chat-panel, .chat-panel {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.chat-label {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text2);
  padding: 10px 12px 5px; flex-shrink: 0;
}
#chat-messages, #host-chat-messages {
  flex: none; overflow-y: auto; padding: 4px 10px;
  display: flex; flex-direction: column; gap: 4px;
  height: 160px; min-height: 160px; max-height: 160px;
  flex-shrink: 0;
}
.chat-msg {
  font-size: 12px; line-height: 1.4; color: var(--text); word-break: break-word;
}
.chat-msg .chat-author { font-weight: 700; color: var(--accent); margin-right: 4px; }
.chat-msg.host-msg .chat-author { color: var(--green); }
.chat-msg.system-msg { color: var(--text2); font-style: italic; }

#chat-input-row {
  display: flex; gap: 6px; padding: 5px 10px 8px; flex-shrink: 0;
}
#chat-input, #host-chat-input {
  flex: 1; background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 8px; color: var(--text); font-size: 12px;
  padding: 5px 9px; outline: none; font-family: inherit; width: auto;
}
#chat-input:focus, #host-chat-input:focus { border-color: var(--accent); }
#chat-send-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 5px 10px; cursor: pointer;
  font-size: 13px; font-weight: 700; transition: all .2s; flex-shrink: 0;
}
#chat-send-btn:hover { background: var(--accent2); }

/* ══════════════════════════════════════════════════════════
   MUSIC SECTION (shared — sidebar in both host + player)
   ══════════════════════════════════════════════════════════ */
.music-section {
  border-top: 1px solid var(--glass-border);
  padding: 8px 12px 10px;
  flex-shrink: 0;
}
.music-section-title {
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text2); margin-bottom: 7px;
}
.music-now-playing {
  font-size: 12px; color: var(--green); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 18px; margin-bottom: 6px;
}
.music-controls {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.music-vol-label { font-size: 10px; color: var(--text2); min-width: 26px; }
.music-vote-status {
  font-size: 10px; color: var(--text2); margin-top: 4px; min-height: 14px;
}
.music-queue-list {
  margin-top: 6px; max-height: 70px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.music-queue-item {
  font-size: 11px; color: var(--text2); padding: 3px 6px;
  background: var(--glass); border-radius: 5px;
  display: flex; align-items: center; gap: 5px;
  border: 1px solid var(--glass-border);
}
.music-queue-item .mq-num {
  color: var(--green); font-weight: 700; min-width: 14px; font-size: 10px;
}
.music-queue-item .mq-title {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.music-queue-item .mq-del {
  background: none; border: none; color: var(--text2); cursor: pointer;
  font-size: 11px; line-height: 1; padding: 1px 3px;
  transition: color .15s;
}
.music-queue-item .mq-del:hover { color: var(--red); }

/* ══════════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(12,13,25,0.97); border: 1px solid var(--glass-border);
  color: var(--text); font-size: 13px; font-weight: 500;
  padding: 10px 16px; border-radius: 10px;
  backdrop-filter: blur(12px); box-shadow: 0 4px 20px rgba(0,0,0,.5);
  animation: toastIn .25s cubic-bezier(.16,1,.3,1) forwards;
  pointer-events: none; max-width: 300px;
}
.toast.success { border-color: rgba(87,242,135,.4); color: var(--green); }
.toast.error   { border-color: rgba(237,66,69,.4);  color: var(--red); }
.toast.warning { border-color: rgba(87,242,135,.4);  color: var(--green); }

/* ══════════════════════════════════════════════════════════
   MODAL BASE (shared)
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,10,.88); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--glass-border);
  border-radius: 16px; padding: 28px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
  animation: fadeSlideUp .3s cubic-bezier(.16,1,.3,1);
}
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 800; color: var(--green); font-family: 'Inter', sans-serif; }
.modal-close {
  background: none; border: none; color: var(--text2);
  font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; transition: color .2s;
}
.modal-close:hover { color: var(--white); }
.form-group { margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ══════════════════════════════════════════════════════════
   ROOM CODE TOP BANNER (shared — host + player)
   ══════════════════════════════════════════════════════════ */
.room-topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 20px;
  background: rgba(2,8,23,0.96);
  border-bottom: 1px solid rgba(87,242,135,0.18);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  position: relative;
  z-index: 9;
  flex-wrap: wrap;
}
.room-topbar-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--text2);
  text-transform: uppercase;
}
.room-topbar-code {
  font-size: 26px;
  font-weight: 900;
  color: #57F287;
  letter-spacing: 10px;
  font-family: 'Bebas Neue', sans-serif;
  text-shadow: 0 0 22px rgba(87,242,135,0.5);
  animation: roomCodePulse 3s ease-in-out infinite;
}
@keyframes roomCodePulse {
  0%,100% { text-shadow: 0 0 18px rgba(87,242,135,.4); }
  50%      { text-shadow: 0 0 34px rgba(87,242,135,.7), 0 0 55px rgba(87,242,135,.3); }
}
.room-topbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.room-topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(87,242,135,0.08);
  border: 1px solid rgba(87,242,135,0.22);
  border-radius: 8px;
  padding: 4px 10px;
  color: #57F287;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  flex-shrink: 0;
}
.room-topbar-link:hover {
  background: rgba(87,242,135,0.16);
  border-color: rgba(87,242,135,0.42);
}

/* ══════════════════════════════════════════════════════════
   MOBILE — shared responsive base
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Touch targets: only interactive action buttons, not all buttons */
  .btn:not(.btn-sm):not(.modal-close):not(.lang-btn):not(#chat-send-btn) {
    min-height: 40px;
  }

  /* Sidebar: full-width overlay on mobile */
  .board-sidebar, .host-side-panel {
    width: 100%;
    max-width: 100%;
  }

  /* Topbar wraps on narrow screens */
  .board-topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-height);
    padding: 6px 10px;
  }

  /* Volume slider full width on mobile */
  input[type="range"]#sound-volume {
    width: 80px;
  }

  /* Chat: fixed size on mobile too */
  #chat-messages, #host-chat-messages {
    height: 160px;
    min-height: 160px;
    max-height: 160px;
  }
}
