* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px system-ui, sans-serif;
  background: #0f0f0f;
  color: #f1f1f1;
}
main { max-width: 1160px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
#join-form { width: 100%; max-width: 480px; align-self: center; }

/* Player + queue on the left, chat on the right; stacked on narrow screens. */
#jam { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
#jam .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.chat { overflow: hidden; position: sticky; top: 20px; height: calc(100vh - 40px); max-height: 820px; min-height: 360px; }
@media (max-width: 900px) {
  #jam { grid-template-columns: minmax(0, 1fr); }
  .chat { position: static; height: 460px; }
}
.messages { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.msg { max-width: 85%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg .meta { font-size: 11px; color: #999; margin: 0 4px 3px; }
.msg .bubble {
  display: inline-block; padding: 8px 12px; border-radius: 14px; background: #2e2e2e;
  font-size: 14px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; text-align: left;
}
.msg.mine .bubble { background: #ff0033; }
.messages .empty { margin: auto; color: #888; font-size: 14px; }
#chat-form input { flex: 1; min-width: 0; }
#chat-form { position: relative; }
.emoji-btn { flex: none; width: 40px; padding: 0; font-size: 18px; background: none; }
.emoji-btn:hover { background: #333; }
.emoji-pop {
  position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; width: 300px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px;
  background: #282828; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.6);
}
.emoji-pop .emoji { padding: 4px 0; font-size: 20px; line-height: 1; background: none; border-radius: 6px; font-weight: 400; }
.emoji-pop .emoji:hover { background: #3a3a3a; }
.emoji-tip { grid-column: 1 / -1; margin-top: 4px; font-size: 11px; color: #999; text-align: center; }
header { display: flex; align-items: center; justify-content: space-between; }
h1 { margin: 0; font-size: 22px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #333; }
.pill.ok { background: #1d6b35; }
.pill.warn { background: #7a5b00; }
.card { background: #1b1b1b; border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card p { margin: 0; color: #bbb; }
[hidden] { display: none !important; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #aaa; }
input {
  padding: 9px; border-radius: 6px; border: 1px solid #333;
  background: #111; color: inherit; font: inherit;
}
button {
  padding: 9px 14px; border-radius: 6px; border: none; cursor: pointer;
  background: #2a2a2a; color: inherit; font: inherit; font-weight: 600;
}
button:hover { background: #3a3a3a; }
button.primary { background: #ff0033; }
button.primary:hover { background: #e0002d; }
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.player-wrap iframe, #player { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay {
  position: absolute; inset: 0; width: 100%; border-radius: 0;
  background: rgba(0, 0, 0, .75); font-size: 20px;
}
.now { font-size: 16px; }
.controls { display: flex; align-items: center; gap: 12px; }
.volume { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }
.icon-btn { padding: 6px 8px; background: none; font-size: 16px; }
#volume-pct { width: 40px; text-align: right; font-size: 13px; color: #bbb; font-variant-numeric: tabular-nums; }

/* Volume slider: own styling (the generic input box style must not apply), filled part in red. */
input[type="range"] {
  --fill: 80%;
  flex: 0 1 160px; height: 18px; padding: 0; margin: 0; border: none; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, #ff0033 var(--fill), #444 var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff;
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #444; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: #ff0033; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #fff; }

/* Song progress (read-only: the host controls seeking). */
.progress { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #bbb; font-variant-numeric: tabular-nums; }
.progress[hidden] { display: none; }
.progress .track { flex: 1; height: 4px; border-radius: 2px; background: #444; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: #ff0033; }
#elapsed, #remaining { min-width: 40px; }
#remaining { text-align: right; }
.row { display: flex; gap: 6px; }
.row input { flex: 1; }
.label { font-size: 13px; color: #aaa; }
ul, ol { margin: 0; padding-left: 20px; }
.add { display: flex; flex-direction: column; gap: 8px; }
.add .row button { flex: 1; }
#queue li { padding: 4px 0; }
#queue .song { display: flex; align-items: center; gap: 8px; }
#queue .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue .by { font-size: 12px; color: #888; }
#queue button { padding: 2px 8px; background: none; color: #888; font-weight: 400; }
#queue button:hover { color: #ff6b6b; }
.hint { font-size: 13px; color: #888; }
#members li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.kick { padding: 2px 8px; border-radius: 10px; background: none; color: #999; font-size: 12px; }
.kick:hover { color: #fff; background: #333; }
.kick.armed { background: #ff0033; color: #fff; }
.error { color: #ff6b6b; font-size: 13px; margin: 0; }
.small { font-size: 12px; color: #999; }
.small a { color: inherit; }
