:root {
  color-scheme: dark;
  --bg: #101312;
  --surface: #171b19;
  --surface-2: #202721;
  --border: #304037;
  --text: #f4f6f2;
  --muted: #a8b3aa;
  --primary: #40d874;
  --primary-ink: #06110a;
  --accent: #ffce5c;
  --danger: #ff6b7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(64, 216, 116, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(255, 206, 92, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

button, input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--surface);
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand small,
.muted {
  display: block;
  color: var(--muted);
}

.split-view,
.room-view {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: stretch;
}

.room-view {
  grid-template-columns: 360px minmax(0, 1fr);
}

.panel {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.intro-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.96;
  max-width: 860px;
  letter-spacing: 0;
}

.room-side h1 {
  font-size: 2rem;
  line-height: 1.05;
}

.lead {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 620px;
}

.form-stack {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.input-row,
.copy-row {
  display: flex;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64, 216, 116, 0.18);
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn {
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-btn {
  padding: 0 18px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 800;
  white-space: nowrap;
}

.secondary-btn {
  padding: 0 18px;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
  font-weight: 700;
}

.danger-btn {
  padding: 0 18px;
  background: rgba(255, 107, 122, 0.12);
  color: #ffd7dc;
  border-color: rgba(255, 107, 122, 0.42);
  font-weight: 800;
}

.small {
  min-height: 42px;
}

.icon-btn {
  width: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.mini-status,
.status-box,
.share-box,
.volume-row,
.recent {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.status-box {
  display: grid;
  gap: 10px;
}

.mini-status {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.room-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.controls {
  display: flex;
  gap: 10px;
}

.volume-row {
  display: grid;
  gap: 10px;
}

.now-playing {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

.album-fallback,
.album-art {
  width: 112px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  object-fit: cover;
}

.search-bar {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.results {
  display: grid;
  gap: 10px;
}

.track-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.track-row img {
  width: 64px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.track-row h3 {
  margin-bottom: 2px;
  font-size: 1rem;
}

.recent {
  margin-top: 18px;
  color: var(--muted);
}

.recent ul {
  padding-left: 18px;
  margin-bottom: 0;
}

.admin-view {
  max-width: 860px;
  margin: 0 auto;
}

.admin-panel {
  display: grid;
  gap: 20px;
}

.admin-panel h1 {
  font-size: 3rem;
  line-height: 1;
}

.admin-rooms {
  display: grid;
  gap: 10px;
}

.admin-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.admin-room h3 {
  margin-bottom: 2px;
  font-size: 1rem;
}

.admin-room a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(120%);
  max-width: min(520px, calc(100% - 24px));
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--primary-ink);
  background: var(--primary);
  font-weight: 800;
  transition: transform 180ms ease;
  z-index: 20;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .split-view,
  .room-view {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    min-height: auto;
  }

  .input-row,
  .copy-row,
  .track-row,
  .admin-room {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .input-row {
    display: grid;
  }

  .now-playing {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .album-fallback,
  .album-art {
    width: 86px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
