:root {
  --theme: #000000;
  --theme-deep: #0d0d0d;
  --surface: rgba(8, 8, 8, 0.94);
  --surface-2: rgba(16, 16, 16, 0.96);
  --line: rgba(255, 255, 255, 0.14);
  --line-2: rgba(255, 255, 255, 0.28);
  --text: #ffffff;
  --text-2: #c8c8c8;
  --success: #87e6a2;
  --error: #ff8f8f;
  --radius-1: 4px;
  --radius-2: 6px;
  --radius-3: 8px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --max-width: 1160px;
  --ease: 180ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.45;
  overflow-x: hidden;
  background: radial-gradient(circle at 50% -20%, #1a1a1a 0%, #000000 58%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.cosmos-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 4%, rgba(255, 255, 255, 0.08), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.04), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.03), transparent 40%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  opacity: 0.24;
  filter: blur(62px);
  background: rgba(255, 255, 255, 0.12);
}

.orb-a {
  width: 220px;
  height: 220px;
  top: -80px;
  left: -64px;
}

.orb-b {
  width: 220px;
  height: 220px;
  top: 14%;
  right: -72px;
}

.orb-c {
  width: 240px;
  height: 240px;
  bottom: -96px;
  left: 34%;
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.64) 0 1px, transparent 1.2px),
    radial-gradient(circle at 42% 34%, rgba(255, 255, 255, 0.48) 0 1px, transparent 1.2px),
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, 0.48) 0 1px, transparent 1.2px),
    radial-gradient(circle at 88% 76%, rgba(255, 255, 255, 0.34) 0 1px, transparent 1.2px),
    radial-gradient(circle at 28% 82%, rgba(255, 255, 255, 0.34) 0 1px, transparent 1.2px);
  background-size: 340px 340px, 500px 500px, 620px 620px, 700px 700px, 760px 760px;
}

.site-shell,
.dashboard-shell {
  width: min(calc(100% - var(--s-4)), var(--max-width));
  margin-inline: auto;
  padding: var(--s-4) 0 var(--s-7);
}

.topbar,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-3);
  backdrop-filter: blur(4px);
}

.topbar {
  padding: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.panel {
  padding: var(--s-5);
}

.kicker {
  margin: 0;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.7rem;
  font-weight: 700;
}

.brand-block h1 {
  margin: var(--s-1) 0 0;
  font-size: clamp(1.25rem, 4vw, 1.95rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.topbar-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color var(--ease),
    border-color var(--ease),
    color var(--ease),
    transform var(--ease);
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.12);
}

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

.btn:focus-visible,
.tab:focus-visible,
.mobile-nav-toggle:focus-visible,
.mobile-nav-close:focus-visible,
.mobile-nav-link:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.68);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.btn-primary:hover {
  background: #e9e9e9;
  color: #000000;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
}

.btn-small {
  padding: 8px 12px;
  font-size: 0.84rem;
}

.subtle-text {
  margin: 0;
  color: var(--text-2);
  font-size: 0.9rem;
}

.banner {
  margin-top: var(--s-4);
  padding: var(--s-3);
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
}

.banner-error {
  background: rgba(255, 84, 84, 0.14);
  border-color: rgba(255, 84, 84, 0.42);
  color: #ffd0d0;
}

.hero-panel {
  margin-top: var(--s-6);
  text-align: center;
}

.hero-panel h2 {
  margin: var(--s-2) 0 0;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.lede {
  margin: var(--s-3) auto 0;
  max-width: 56ch;
  color: var(--text-2);
}

.hero-actions {
  margin-top: var(--s-5);
  display: flex;
  justify-content: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.now-playing-panel {
  margin-top: var(--s-5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-2);
  padding: var(--s-4);
  background: var(--surface-2);
  text-align: left;
}

.now-playing-card {
  display: flex;
  gap: var(--s-3);
  align-items: center;
}

.now-playing-art {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-1);
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  flex: 0 0 72px;
}

.now-playing-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.now-playing-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-weight: 800;
}

.now-playing-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.now-playing-title {
  margin: 0;
  font-size: 1rem;
}

.now-playing-meta {
  margin: 0;
  color: var(--text-2);
  font-size: 0.86rem;
}

.now-playing-actions {
  margin-top: var(--s-3);
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.tabs-panel {
  margin-top: var(--s-4);
}

.tabs {
  display: flex;
  gap: var(--s-4);
  border-bottom: 1px solid var(--line);
  padding-bottom: var(--s-1);
  flex-wrap: wrap;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 0 0 var(--s-2);
  cursor: pointer;
  font-weight: 700;
  position: relative;
  transition: color var(--ease);
}

.tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  background: transparent;
  transition: background-color var(--ease);
}

.tab:hover,
.tab.is-active {
  color: var(--text);
}

.tab.is-active::after {
  background: #ffffff;
}

.dashboard-grid {
  margin-top: var(--s-5);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  align-items: flex-start;
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}

.panel-head h2 {
  margin: var(--s-1) 0 0;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.analytics-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.analytics-metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--surface-2);
  padding: var(--s-3);
  display: grid;
  gap: 6px;
}

.analytics-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  font-weight: 700;
}

.analytics-metric-card strong {
  font-size: 1.18rem;
  line-height: 1;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-list,
.room-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--s-2);
}

.analytics-list li,
.room-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--surface-2);
  padding: 10px 12px;
  display: flex;
  gap: var(--s-2);
  justify-content: flex-start;
  align-items: center;
}

.analytics-list li span,
.room-item-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.analytics-list li small,
.room-item-main small {
  color: var(--text-2);
  font-size: 0.8rem;
}

.analytics-list li strong,
.room-item-rank {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
}

.analytics-list-empty,
.room-list-empty {
  justify-content: flex-start !important;
  color: var(--text-2);
}

.room-controls {
  display: grid;
  gap: var(--s-3);
}

.room-controls-actions {
  display: flex;
  justify-content: flex-end;
}

.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.room-item-main-wrap {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
}

.room-item-art {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-2);
  overflow: hidden;
  flex: 0 0 68px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
}

.room-item-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.room-item-art-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-weight: 800;
}

.room-page .room-list li {
  padding: 14px 14px;
}

.room-page .room-item-main strong {
  font-size: 1rem;
}

.panel-span-2 {
  grid-column: span 1;
}

.mobile-nav-toggle,
.mobile-nav-backdrop,
.mobile-nav-drawer {
  display: none;
}

.mobile-nav-toggle {
  appearance: none;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: var(--radius-2);
  width: 42px;
  height: 42px;
  padding: 0;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-nav-toggle-lines {
  width: 18px;
  height: 14px;
  display: grid;
  align-content: space-between;
}

.mobile-nav-toggle-lines span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: currentColor;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.66);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 78;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(86vw, 340px);
  background: rgba(8, 8, 8, 0.98);
  border-left: 1px solid var(--line-2);
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 79;
  grid-template-rows: auto 1fr;
}

.mobile-nav-header {
  padding: var(--s-4);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
}

.mobile-nav-kicker {
  margin: 0;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.66rem;
  font-weight: 700;
}

.mobile-nav-title {
  margin: var(--s-1) 0 0;
  font-size: 1rem;
}

.mobile-nav-close {
  appearance: none;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-2);
  min-height: 34px;
  padding: 6px 10px;
  cursor: pointer;
}

.mobile-nav-body {
  padding: var(--s-3);
  overflow-y: auto;
}

.mobile-nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--s-1);
}

.mobile-nav-link {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-2);
  transition: border-color var(--ease), background-color var(--ease), color var(--ease);
}

.mobile-nav-link:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.mobile-nav-link.is-active {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

body.is-mobile-nav-open {
  overflow: hidden;
}

body.is-mobile-nav-open .mobile-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.is-mobile-nav-open .mobile-nav-drawer {
  transform: translateX(0);
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-5);
  }

  .panel-span-2 {
    grid-column: span 2;
  }

  .chart-wrap {
    height: 330px;
  }
}

@media (max-width: 768px) {
  .site-shell,
  .dashboard-shell {
    width: min(calc(100% - var(--s-3)), var(--max-width));
    padding: var(--s-3) 0 var(--s-6);
  }

  .panel,
  .topbar {
    padding: var(--s-4);
  }

  .topbar-actions {
    display: none;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .mobile-nav-backdrop {
    display: block;
  }

  .mobile-nav-drawer {
    display: grid;
  }

  .hero-panel {
    margin-top: var(--s-4);
    text-align: left;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .tabs {
    display: grid;
    gap: var(--s-2);
    border-bottom: 0;
    padding-bottom: 0;
  }

  .tab {
    text-align: left;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }

  .tab::after {
    left: 0;
    right: auto;
    width: 44px;
    bottom: -1px;
  }

  .analytics-metric-grid {
    grid-template-columns: 1fr;
  }

  .room-controls-actions {
    justify-content: flex-start;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-wrap {
    height: 250px;
  }

  .now-playing-art {
    width: 62px;
    height: 62px;
    flex-basis: 62px;
  }

  .room-item-art {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }
}

@media (max-width: 359px) {
  .brand-block h1 {
    font-size: 1.16rem;
  }

  .room-item-main-wrap {
    gap: var(--s-2);
  }

  .room-item-art {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }
}

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