:root {
  color-scheme: dark;
  --bg: #071015;
  --text: #e8f0f6;
  --muted: #9eb0c0;
  --muted-dim: #6f8496;
  --panel: rgba(10, 22, 28, 0.82);
  --panel-border: rgba(125, 211, 199, 0.18);
  --panel-inset: rgba(0, 0, 0, 0.22);
  --accent: #2dd4bf;
  --accent-dark: #167b6f;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --accent-glow: rgba(45, 212, 191, 0.35);
  --danger: #ff8f84;
  --danger-bg: rgba(180, 35, 24, 0.18);
  --danger-border: rgba(242, 107, 90, 0.35);
  --warning: #f5c451;
  --live: #2dd4bf;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
a {
  border-radius: var(--radius-sm);
}

button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  box-shadow: none;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  min-height: 40px;
  padding: 0 14px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

button:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(125, 211, 199, 0.28);
}

button.primary-action {
  background: rgba(22, 123, 111, 0.55);
  border-color: rgba(125, 211, 199, 0.32);
  color: #ecfffb;
  font-weight: 700;
  min-height: 42px;
  padding: 0 18px;
}

button.primary-action:hover {
  background: rgba(22, 123, 111, 0.72);
  border-color: rgba(125, 211, 199, 0.45);
}

button.ghost-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

button.danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  box-shadow: none;
  color: var(--danger);
}

button.danger:hover {
  background: rgba(180, 35, 24, 0.28);
}

a.action-link,
.feed-actions > a {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(125, 211, 199, 0.22);
  box-shadow: none;
  color: var(--accent);
  display: inline-flex;
  font-weight: 700;
  min-height: 40px;
  padding: 0 14px;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}

a.action-link:hover,
.feed-actions > a:hover {
  background: rgba(45, 212, 191, 0.2);
  transform: translateY(-1px);
}

.theme-backdrop {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.theme-orb {
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.5;
  position: absolute;
}

.theme-orb-a {
  background: radial-gradient(circle, #2dd4bf 0%, transparent 70%);
  height: 380px;
  left: -100px;
  top: -140px;
  width: 380px;
}

.theme-orb-b {
  background: radial-gradient(circle, #167b6f 0%, transparent 70%);
  bottom: -160px;
  height: 440px;
  right: -120px;
  width: 440px;
}

.theme-scanlines {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 3px, 3px 100%;
  inset: 0;
  opacity: 0.3;
  position: absolute;
}

.app-body,
.login-body {
  color: var(--text);
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  min-height: 100vh;
  position: relative;
}

.login-body {
  align-items: center;
  display: flex;
  justify-content: center;
  overflow: hidden;
  padding: 24px;
}

.shell {
  display: grid;
  gap: 20px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
  position: relative;
  z-index: 1;
}

.topbar,
.section-heading,
.feed-title-row,
.feed-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.app-brand {
  align-items: center;
  display: flex;
  gap: 16px;
}

.app-mark {
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  flex: none;
}

.app-eyebrow,
.login-eyebrow {
  color: #7dd3c7;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 6px;
}

.topbar-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.auth-bar {
  align-items: center;
  display: flex;
  gap: 10px;
}

.auth-email {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.login-card {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 22px;
  max-width: 440px;
  padding: 32px 28px 28px;
  position: relative;
  width: 100%;
  z-index: 1;
}

.login-brand {
  align-items: center;
  display: flex;
  gap: 16px;
}

.login-mark {
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  flex: none;
}

.login-brand-copy h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 2px 0 0;
}

.login-lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.login-error {
  align-items: flex-start;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 12px;
  color: var(--danger);
  display: flex;
  font-size: 14px;
  gap: 10px;
  line-height: 1.45;
  margin: 0;
  padding: 12px 14px;
}

.login-error-icon {
  align-items: center;
  background: rgba(180, 35, 24, 0.35);
  border-radius: 50%;
  display: inline-flex;
  flex: none;
  font-size: 12px;
  font-weight: 800;
  height: 20px;
  justify-content: center;
  margin-top: 1px;
  width: 20px;
}

.google-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  color: #16202a;
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  gap: 12px;
  justify-content: center;
  min-height: 50px;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
  width: 100%;
}

.google-button:hover {
  background: #f7fafc;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.google-button:active {
  transform: translateY(0);
}

.google-logo {
  flex: none;
  height: 20px;
  width: 20px;
}

.login-footnote {
  align-items: center;
  color: var(--muted-dim);
  display: flex;
  font-size: 13px;
  gap: 8px;
  justify-content: center;
  margin: 0;
}

.login-footnote-dot {
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
  height: 7px;
  width: 7px;
}

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

h2 {
  font-size: 18px;
  font-weight: 700;
}

h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.muted {
  color: var(--muted);
}

.health,
.status-pill {
  align-items: center;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
}

.dot {
  border-radius: 50%;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.dot-live {
  background: var(--live);
  box-shadow: 0 0 10px var(--accent-glow);
}

.dot-offline {
  background: #5f7384;
}

.dot-waiting {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 196, 81, 0.45);
}

.panel,
.feed-card,
.empty {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.create-panel {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.5fr);
  padding: 22px;
}

.panel-intro h2 {
  margin-bottom: 8px;
}

.create-form,
.url-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label,
.copy-row {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
textarea {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(125, 211, 199, 0.14);
  border-radius: var(--radius-sm);
  color: var(--text);
  min-width: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input {
  height: 40px;
  padding: 0 12px;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 10px 12px;
  resize: vertical;
}

input::placeholder {
  color: #5f7384;
}

input:focus,
textarea:focus {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
  outline: none;
}

input[readonly],
textarea[readonly] {
  color: #c5d4df;
  font-size: 13px;
}

input[type="radio"] {
  height: auto;
}

fieldset {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.wide {
  grid-column: 1 / -1;
}

.create-form .primary-action {
  align-self: end;
}

.feeds-section {
  display: grid;
  gap: 12px;
}

.empty {
  color: var(--muted);
  padding: 32px;
  text-align: center;
}

.feed-list {
  display: grid;
  gap: 14px;
}

.feed-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.feed-main {
  display: grid;
  gap: 14px;
}

.feed-description {
  margin-top: 4px;
}

.stats {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin: 0;
}

.stats div {
  background: var(--panel-inset);
  border: 1px solid rgba(125, 211, 199, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stats dt {
  color: var(--muted-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.stats dd {
  font-weight: 700;
  margin: 0;
  min-height: 22px;
}

.stats .stat-rate {
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats .stat-total {
  color: var(--muted-dim);
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.copy-row {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) auto;
}

.copy-row button {
  font-size: 13px;
  min-height: 40px;
  min-width: 72px;
  padding: 0 12px;
}

.feed-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.edit-form {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(125, 211, 199, 0.12);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  grid-column: 1 / -1;
}

[hidden] {
  display: none !important;
}

.player-body {
  background: var(--bg);
}

.player-shell {
  align-items: center;
  background: var(--bg);
  display: grid;
  min-height: 100vh;
  position: relative;
}

.player-shell video {
  aspect-ratio: 16 / 9;
  background: #020506;
  display: block;
  height: auto;
  max-height: 100vh;
  object-fit: contain;
  width: 100%;
}

.player-overlay {
  align-items: center;
  background: rgba(7, 16, 21, 0.82);
  color: white;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.player-overlay[hidden] {
  display: none;
}

.player-overlay h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.player-overlay p {
  color: #b8c7d6;
}

@media (max-width: 760px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .feed-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-brand {
    align-items: flex-start;
  }

  .create-panel,
  .create-form,
  .edit-form,
  .url-grid,
  .stats {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .copy-row {
    grid-template-columns: 1fr;
  }
}
