/* TogetherBeat — dark music app. System type, one accent, no glow. */
:root {
  --bg: #0c0c10;
  --bg-raise: #15151b;
  --bg-hover: #1e1e26;
  --line: #2a2a34;
  --text: #f4f4f6;
  --text-2: #b4b4c0;
  --text-3: #8a8a98;
  --accent: #d4ff3a;
  --accent-ink: #11140a;
  --danger: #ff6b6b;
  --ok: #4ade80;
  --warn: #fbbf24;
  --r: 12px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html { color-scheme: dark; }
body {
  background: var(--bg) !important;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  font-family: inherit !important;
  -webkit-font-smoothing: antialiased;
}
body::before, body::after { content: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
input, textarea { caret-color: var(--accent); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- surfaces: remap legacy class names used by app.js ---------- */
body .glass-card {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  backdrop-filter: none;
  box-shadow: none;
}
body .glass-card:hover { box-shadow: none; border-color: var(--line); }
body .bg-gray-800, body .bg-gray-800\/50 { background: var(--bg-hover) !important; }
body .bg-gray-900 { background: var(--bg) !important; }
body .border-gray-600, body .border-gray-700 { border-color: var(--line) !important; }
body .border-cyan-400, body .border-pink-400, body .border-green-400 { border-color: var(--line) !important; }
body .text-cyan-400, body .text-cyan-300, body .text-cyan-200 { color: var(--accent) !important; }
body .text-pink-400, body .text-green-400 { color: var(--text-2) !important; }
body .text-gray-300 { color: var(--text-2) !important; }
body .text-gray-400, body .text-gray-500, body .text-gray-600 { color: var(--text-3) !important; }
body .text-red-400 { color: var(--danger) !important; }
body .bg-cyan-400\/20 { background: rgba(12,12,16,.62) !important; }

/* ---------- buttons ---------- */
body .neon-button, .btn {
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  border: 0 !important;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .2s var(--ease), filter .2s var(--ease);
}
body .neon-button:hover, .btn:hover { transform: none; box-shadow: none; filter: brightness(1.08); }
body .neon-button:active, .btn:active { transform: scale(.97); }
.btn-ghost {
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.btn-ghost:hover { background: var(--bg-hover) !important; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px;
  background: transparent; color: var(--text); border: 0; cursor: pointer;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- fields ---------- */
body input[type=text], body input[type=number], body select, body textarea {
  background: var(--bg-hover) !important;
  color: var(--text);
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  min-height: 44px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
body input::placeholder { color: var(--text-3) !important; }
body input[type=text]:focus, body input[type=number]:focus, body select:focus {
  outline: none; border-color: var(--accent) !important; background: var(--bg) !important;
}
body input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent) !important; outline-offset: 2px;
}
label { color: var(--text-2); }

/* ---------- welcome ---------- */
#welcome-screen {
  background: var(--bg) !important;
  align-items: center;
}
.wl-wrap { width: min(440px, calc(100vw - 32px)); margin: auto; padding: 24px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.wl-head { font-size: clamp(2rem, 7vw, 2.75rem); line-height: 1.05; font-weight: 800; letter-spacing: -.03em; margin: 28px 0 10px; text-wrap: balance; }
.wl-sub { color: var(--text-2); margin-bottom: 28px; max-width: 34ch; }
.wl-card { background: var(--bg-raise); border: 1px solid var(--line); border-radius: 20px; padding: 20px; }
.wl-card h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.wl-card .stack > * + * { margin-top: 10px; }
.wl-or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 13px; margin: 16px 0; }
.wl-or::before, .wl-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#room-code-input:not(:placeholder-shown) { text-transform: uppercase; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.steps { list-style: none; display: grid; gap: 8px; margin-top: 22px; color: var(--text-2); font-size: 14px; }
.steps li { display: flex; gap: 10px; align-items: baseline; }
.steps b { color: var(--text); font-weight: 600; }

/* ---------- app shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 30;
}
.topbar .room-meta { min-width: 0; flex: 1; }
#room-name { display: block; font-weight: 700; font-size: 16px; max-width: none !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-variant-numeric: tabular-nums; letter-spacing: .14em; font-weight: 700; font-size: 12px;
  color: var(--text-2);
}
.code-chip span { color: var(--text-2) !important; font-size: 12px !important; }
.code-chip .hidden { display: none !important; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); background: transparent; color: var(--text-2);
}
.status-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--text-3); box-shadow: none; }
.status-dot.online { background: var(--ok); box-shadow: none; }
.status-dot.sync { background: var(--warn); box-shadow: none; }
.status-dot.offline { background: var(--danger); box-shadow: none; }
#qr-button { padding: 0 16px; height: 40px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
#qr-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
#settings-button { padding: 0 !important; width: 40px; height: 40px; font-size: 0 !important; display: grid; place-items: center; }

.layout { display: grid; gap: 16px; padding: 16px; grid-template-columns: 1fr; max-width: 1560px; margin: 0 auto; }
.layout > section { min-width: 0; }
.col-player { order: -1; }
.col-queue { order: 0; }
.col-social { order: 1; }
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; }
  .col-player { order: 2; position: sticky; top: 72px; }
  .col-queue { order: 1; }
  .col-social { order: 3; }
}
.panel { padding: 16px; }
.panel-title { font-size: 13px; font-weight: 700; color: var(--text-2) !important; letter-spacing: .02em; margin-bottom: 12px; }

/* player */
body .video-container {
  position: relative; width: 100%; height: 0; overflow: hidden;
  background: #000; border-radius: 12px; box-shadow: none;
  padding-bottom: 56.25%; max-height: none; min-height: 0;
}
#now-playing-indicator, #now-playing-indicator-mobile { color: var(--text) !important; max-width: 100%; }
#host-controls {
  background: transparent !important; border: 0 !important; box-shadow: none !important;
  padding: 8px 0 !important; margin-bottom: 8px; gap: 8px;
}
#host-controls::before { content: none !important; }
body #host-controls button {
  background: transparent !important; box-shadow: none !important; backdrop-filter: none;
  width: 52px; height: 52px; min-width: 52px; min-height: 52px; padding: 0 !important;
  border-radius: 999px; font-size: 0 !important; color: var(--text) !important;
  display: grid; place-items: center; animation: none !important; transform: none;
}
body #host-controls button:hover { background: var(--bg-hover) !important; transform: none; }
body #host-controls button:hover::after { content: none; }
body #host-controls button::before {
  content: ""; position: static; width: 24px; height: 24px; background: currentColor !important;
  -webkit-mask: var(--ic) center/contain no-repeat; mask: var(--ic) center/contain no-repeat; transition: none;
}
body #host-controls button:hover::before { width: 24px; height: 24px; }
body #host-controls button span { all: unset; }
#prev-btn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 5h2v14H6zM20 5v14L9 12z'/%3E%3C/svg%3E"); }
#next-btn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16 5h2v14h-2zM4 5v14l11-7z'/%3E%3C/svg%3E"); }
#shuffle-btn { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 3h5v5M4 20 21 3M21 16v5h-5M15 15l6 6M4 4l5 5'/%3E%3C/svg%3E"); }
body #host-controls #play-pause-btn {
  --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4v16l13-8z'/%3E%3C/svg%3E");
  background: var(--accent) !important; color: var(--accent-ink) !important;
  width: 64px; height: 64px; min-width: 64px; min-height: 64px;
}
body #host-controls #play-pause-btn:hover { background: var(--accent) !important; filter: brightness(1.08); }
body #host-controls #play-pause-btn[data-state="playing"] {
  --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 4h4v16H6zM14 4h4v16h-4z'/%3E%3C/svg%3E");
}
body #host-controls #play-pause-btn::before { width: 28px; height: 28px; }

/* add / search */
.add-row { display: flex; gap: 8px; }
.add-row input { flex: 1; min-width: 0; padding: 0 14px; }
.add-row .btn, .add-row .neon-button { padding: 0 22px; min-height: 44px; flex: none; white-space: nowrap; }
#search-results { background: var(--bg) !important; border-radius: 12px; padding: 4px !important; max-height: 320px; }
#search-results > * { border-radius: 10px; }
#search-results > *:hover { background: var(--bg-hover); }

/* queue */
#playlist-container { max-height: none !important; display: flex; flex-direction: column; gap: 2px; counter-reset: q; }
@media (min-width: 1024px) { #playlist-container { max-height: calc(100vh - 220px) !important; overflow-y: auto; } }
@media (max-width: 1023px) { #playlist-container { max-height: 420px !important; overflow-y: auto; } }
body .playlist-item {
  background: transparent !important; padding: 8px !important; border-radius: 10px;
  counter-increment: q; transition: background .2s var(--ease);
  display: flex; align-items: center; gap: 12px;
}
body .playlist-item > * + * { margin-left: 0 !important; }
body .playlist-item::before { content: counter(q); width: 20px; text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: 13px; flex: none; }
body .playlist-item:hover { background: var(--bg-hover) !important; }
body .playlist-item-current { background: var(--bg-hover) !important; }
body .playlist-item-current::before { color: var(--accent); }
body .playlist-item img { width: 56px !important; height: 42px !important; border-radius: 6px !important; transform: none !important; }
body .playlist-item h4 { font-size: 14px; font-weight: 600; }
body .playlist-item p { font-size: 12px; margin: 0; }
.now-bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.now-bars i { width: 3px; background: var(--accent); border-radius: 1px; animation: bar 1s ease-in-out infinite; }
.now-bars i:nth-child(2) { animation-delay: -.3s; } .now-bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes bar { 0%,100% { height: 4px; } 50% { height: 14px; } }
.playlist-item-enter { animation: enter .5s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

/* empty states */
.empty-state-card { border: 1px dashed var(--line); background: transparent; border-radius: 12px; padding: 20px 16px; color: var(--text-2); text-align: center; }
.empty-state-card .text-xl { display: none; }

/* social */
#active-users { gap: 6px !important; }
#chat-messages { background: var(--bg) !important; border-radius: 12px !important; max-height: 280px !important; min-height: 140px; }
#chat-messages, #playlist-container, #search-results { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
#chat-messages::-webkit-scrollbar, #playlist-container::-webkit-scrollbar, #search-results::-webkit-scrollbar { width: 8px; }
#chat-messages::-webkit-scrollbar-thumb, #playlist-container::-webkit-scrollbar-thumb, #search-results::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; background-image: none; }
#chat-messages::-webkit-scrollbar-track, #playlist-container::-webkit-scrollbar-track, #search-results::-webkit-scrollbar-track { background: transparent; }
.chat-row { display: flex; gap: 8px; }
.chat-row input { flex: 1; min-width: 0; padding: 0 14px; }
#send-chat-btn { width: 44px; height: 44px; padding: 0 !important; display: grid; place-items: center; flex: none; }
#send-chat-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.reactions { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; }
.reaction-btn {
  flex: 1; height: 44px; font-size: 22px; border-radius: 12px; background: var(--bg-hover); border: 0; cursor: pointer;
  transition: transform .2s var(--ease), background .2s var(--ease);
}
.reaction-btn:hover { background: var(--line); transform: translateY(-2px); }
.reaction-btn:active { transform: scale(.92); }

/* toasts and modals */
.toast-notification {
  background: var(--text) !important; color: var(--bg) !important; border: 0 !important;
  border-radius: 12px !important; box-shadow: 0 8px 24px rgba(0,0,0,.45) !important;
}
.toast-notification * { color: inherit !important; }
.modal-back { background: rgba(0,0,0,.7) !important; }
.modal-back .glass-card { background: var(--bg-raise); }
#delete-room-btn { background: transparent !important; color: var(--danger) !important; border: 1px solid var(--danger) !important; border-radius: 999px !important; }
#delete-room-btn:hover { background: rgba(255,107,107,.1) !important; }
#share-room-code { font-size: 36px !important; letter-spacing: .18em; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: none !important; color: var(--text); }
#qr-code-container { background: #fff; padding: 12px; border-radius: 12px; }

/* footer */
.foot { padding: 24px 16px 32px; color: var(--text-3); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; border-top: 1px solid var(--line); margin-top: 8px; }
.foot a { color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.foot a:hover { color: var(--text); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang button { background: transparent; color: var(--text-2); border: 0; font-size: 12px; font-weight: 700; padding: 6px 10px; cursor: pointer; min-height: 32px; }
.lang button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.wl-lang { position: absolute; top: 16px; right: 16px; }

#loading-screen { background: var(--bg) !important; }
#loading-screen h1 { text-shadow: none !important; }

@media (max-width: 600px) {
  .topbar { padding: 8px 12px; }
  .layout { padding: 12px; gap: 12px; }
  .hide-sm { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

#close-room-btn { height: 40px; padding: 0 16px; font-size: 14px; color: var(--danger) !important; border-color: var(--danger) !important; white-space: nowrap; }
#close-room-btn:hover { background: rgba(255,107,107,.1) !important; }
.video-container iframe, .video-container #youtube-player { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
body #host-controls button { line-height: 0; }
