:root {
  --bg: #0b1624;
  --bg-2: #0e1b2e;
  --panel: #14243a;
  --panel-2: #1b2e4a;
  --accent: #003893;
  --accent-2: #1e88e5;
  --text: #e8eef7;
  --text-dim: #9fb3cc;
  --danger: #ff4d4d;
  --success: #43e08c;
  --warn: #fdd835;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: radial-gradient(circle at top, var(--bg-2) 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: var(--accent-2);
}

.brand {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 100;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.brand img {
  width: 120px;
  height: auto;
  display: block;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 96px 24px 48px;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 22px;
  color: var(--text);
}

.subtitle {
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 24px;
}

.card {
  background: var(--panel);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.card + .card {
  margin-top: 20px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input[type='text'],
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-2);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

input[type='text']:focus,
select:focus {
  border-color: var(--accent-2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}

.btn:hover {
  background: #0049bf;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  background: #2b3b58;
  cursor: not-allowed;
}

.btn.secondary {
  background: var(--panel-2);
}

.btn.danger {
  background: var(--danger);
}

.btn.success {
  background: var(--success);
  color: #0b1624;
}

.btn.full {
  width: 100%;
}

.rooms {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.room {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-2);
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 12px;
  flex-wrap: wrap;
}

.room .left {
  min-width: 0;
}

.room .code {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.room .players {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.room .badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.room .badge.playing {
  background: var(--warn);
  color: #241800;
}

.room .badge.waiting {
  background: #2b3b58;
}

.room .badge.finished {
  background: var(--success);
  color: #0b1624;
}

.empty {
  color: var(--text-dim);
  font-style: italic;
}

.flash {
  padding: 10px 14px;
  background: rgba(255, 77, 77, 0.15);
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 14px;
}

.flash.ok {
  background: rgba(67, 224, 140, 0.12);
  border-left-color: var(--success);
}

.symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--panel-2);
  font-size: 16px;
  margin-right: 6px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  font-size: 13px;
  margin: 3px 3px 0 0;
}

.player-chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.player-chip.dead {
  opacity: 0.45;
  text-decoration: line-through;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.footer {
  margin-top: 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

/* Shared music / jukebox overlay */
.music-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 12, 24, 0.9);
  backdrop-filter: blur(8px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.music-overlay.open {
  display: flex;
}
.music-panel {
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.music-panel .head {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.music-panel .head h3 {
  margin: 0;
  font-size: 18px;
}
.music-panel .head .close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
}
.music-panel .list {
  overflow-y: auto;
  padding: 8px;
}
.music-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.12s;
}
.music-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.music-item.active {
  background: rgba(30, 136, 229, 0.18);
  border-color: rgba(30, 136, 229, 0.4);
}
.music-item .meta {
  flex: 1;
  min-width: 0;
}
.music-item .title {
  font-weight: 600;
  line-height: 1.2;
}
.music-item .composer {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 3px;
}
.music-item .badge {
  font-size: 16px;
  width: 28px;
  text-align: center;
}
.music-panel .foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}
.music-panel .foot .now-playing {
  font-size: 12px;
  color: var(--text-dim);
  min-width: 0;
  flex: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.music-panel .foot .stop-btn {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.music-panel .foot .stop-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
