:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: #101827;
  --surface: #172033;
  --surface-2: #202a40;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #a7b3c7;
  --blue: #4f7cff;
  --cyan: #22d3ee;
  --green: #35d07f;
  --amber: #f5b84b;
  --danger: #ef5c69;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: hidden;
  background: #070a12 url("./assets/tv_gradient_3840x2160.png") center / cover fixed;
  color: var(--text);
}

button, input {
  font: inherit;
}

button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 850;
  padding: 12px 18px;
}

button:focus,
button:hover,
input:focus {
  outline: 4px solid var(--cyan);
  outline-offset: 3px;
  background: #e9fbff;
  color: #06101d;
}

button.active {
  border-color: rgba(53, 208, 127, 0.72);
  background: rgba(53, 208, 127, 0.18);
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  padding: 28px 38px 44px;
  background: rgba(4, 8, 16, 0.62);
}

.top-bar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 26, 0.9);
}

.brand,
nav,
.panel-actions,
.player-chrome {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 260px;
}

.brand img {
  width: 46px;
  height: 46px;
}

.brand span {
  font-size: 26px;
  font-weight: 950;
}

.top-bar h1 {
  margin: 0;
  text-align: center;
  font-size: 28px;
}

nav {
  justify-content: flex-end;
  gap: 10px;
}

nav button {
  min-width: 86px;
}

.login-view,
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  margin-top: 26px;
}

.login-view {
  grid-template-columns: minmax(0, 1fr) 380px 380px;
  align-items: stretch;
}

.login-copy,
.qr-panel,
.email-login,
.status-panel,
.empty-state,
.utility-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 39, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.login-copy,
.qr-panel,
.email-login,
.status-panel,
.empty-state {
  padding: 24px;
}

.login-copy h2,
.hero h2 {
  max-width: 760px;
  margin: 0 0 14px;
  font-size: 52px;
  line-height: 1.02;
}

.hero {
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(18, 28, 47, 0.96), rgba(9, 15, 28, 0.92));
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p,
small,
.status-panel span,
.media-card span,
.player-chrome span {
  color: var(--muted);
}

.qr-code {
  display: grid;
  place-items: center;
  min-height: 148px;
  margin: 12px 0;
  border-radius: 8px;
  background: #f8fafc;
  color: #06101d;
  font-size: 42px;
  font-weight: 950;
  letter-spacing: 0.12em;
}

[data-tv-qr-link] {
  min-height: 42px;
  word-break: break-word;
  font-size: 13px;
}

.email-login {
  display: grid;
  gap: 14px;
}

.email-login h3,
.status-panel b {
  margin: 0;
  font-size: 26px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 760;
}

input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1220;
  color: var(--text);
  padding: 10px 14px;
}

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

.panel-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.rows {
  display: grid;
  gap: 26px;
  margin-top: 28px;
}

.media-row h2 {
  margin: 0 0 12px;
  font-size: 29px;
}

.media-strip {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 6px 18px;
  scroll-padding-inline: 8px;
}

.media-card {
  position: relative;
  flex: 0 0 246px;
  min-height: 206px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  text-align: left;
  border-radius: 8px;
  background: var(--panel);
}

.media-card:focus {
  transform: translateY(-4px) scale(1.03);
}

.art-frame,
.media-card img,
.media-fallback {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue), var(--green), var(--amber));
}

.media-card img {
  height: 100%;
  object-fit: cover;
}

.media-fallback {
  display: grid;
  place-items: center;
  font-size: 42px;
  font-weight: 950;
}

.media-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card i {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 4px;
  border-radius: 999px;
  background: var(--green);
}

.utility-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.utility-grid article {
  display: grid;
  gap: 10px;
  padding: 20px;
}

.utility-grid b {
  font-size: 16px;
  color: var(--muted);
}

.utility-grid span {
  font-size: 24px;
  font-weight: 850;
}

.player {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
}

.player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-chrome {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 30px;
  min-height: 86px;
  justify-content: space-between;
  gap: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 10, 18, 0.88);
}

.player-chrome div {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}

.player-chrome strong,
.player-chrome span,
.player-chrome small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  gap: 12px;
  background: rgba(4, 8, 16, 0.64);
}

.spinner {
  width: 58px;
  height: 58px;
  border: 5px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--cyan);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1200px) {
  .top-bar,
  .login-view,
  .hero,
  .utility-grid {
    grid-template-columns: 1fr;
  }

  nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
