:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-strong: #eef2ee;
  --text: #16201c;
  --muted: #61706a;
  --line: #d4ddd6;
  --primary: #216b55;
  --primary-strong: #174d3d;
  --accent: #c4553d;
  --gold: #d69b2f;
  --sky: #8ab6d6;
  --shadow: 0 16px 42px rgb(22 32 28 / 10%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101514;
  --surface: #1a2220;
  --surface-strong: #24302d;
  --text: #eff5f1;
  --muted: #a9b7b0;
  --line: #33423d;
  --primary: #68c2a4;
  --primary-strong: #9bdabe;
  --accent: #e78670;
  --gold: #e7b95d;
  --sky: #9ec7e4;
  --shadow: 0 16px 42px rgb(0 0 0 / 30%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101514;
    --surface: #1a2220;
    --surface-strong: #24302d;
    --text: #eff5f1;
    --muted: #a9b7b0;
    --line: #33423d;
    --primary: #68c2a4;
    --primary-strong: #9bdabe;
    --accent: #e78670;
    --gold: #e7b95d;
    --sky: #9ec7e4;
    --shadow: 0 16px 42px rgb(0 0 0 / 30%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sky), transparent 78%), transparent 19rem),
    var(--bg);
}

body,
button,
input,
select {
  font: inherit;
}

button,
input,
select {
  color: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--surface);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.topbar,
.brand,
.nav,
.hero,
.hero-actions,
.stats-band,
.section-heading,
.settings-grid,
.video-actions,
.preview-caption,
.toolbar {
  display: flex;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 76px;
  padding: 0.8rem 0;
  background: color-mix(in srgb, var(--bg), transparent 8%);
  backdrop-filter: blur(18px);
}

.brand {
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  font-weight: 900;
}

.topbar h1,
.hero h2,
.post-panel h2,
.settings-panel h2,
.video-card h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(1.35rem, 4vw, 1.8rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  gap: 0.35rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 18%);
}

.nav a {
  min-width: 5.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  outline: none;
}

main {
  display: grid;
  gap: 1rem;
}

.hero {
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(1rem, 4vw, 2rem);
  min-height: 430px;
  padding: clamp(1.25rem, 5vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
  max-width: 690px;
}

.hero h2 {
  max-width: 13ch;
  font-size: clamp(2.5rem, 8vw, 5.9rem);
}

.hero p:not(.eyebrow) {
  max-width: 58ch;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.6;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.hero-preview {
  display: grid;
  align-self: stretch;
  min-width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-strong);
}

.stream-frame,
.poster {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold), transparent 35%), transparent 52%),
    linear-gradient(315deg, color-mix(in srgb, var(--sky), transparent 18%), var(--surface-strong));
}

.stream-frame {
  min-height: 300px;
}

.stream-frame::before,
.poster::before {
  content: "";
  position: absolute;
  width: 58%;
  aspect-ratio: 1;
  border: 10px solid color-mix(in srgb, var(--surface), transparent 16%);
  border-radius: 999px;
}

.stream-frame::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: 23%;
  width: 20%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent), transparent 18%);
  box-shadow:
    -4.4rem -1.2rem 0 color-mix(in srgb, var(--primary), transparent 8%),
    -2.3rem 1.6rem 0 color-mix(in srgb, var(--gold), transparent 6%);
}

.play-mark {
  position: relative;
  z-index: 1;
  width: 4rem;
  height: 4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text), transparent 16%);
}

.play-mark::after {
  content: "";
  position: absolute;
  top: 1.12rem;
  left: 1.48rem;
  border-top: 0.8rem solid transparent;
  border-bottom: 0.8rem solid transparent;
  border-left: 1.2rem solid var(--surface);
}

.preview-caption {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
}

.preview-caption span {
  color: var(--muted);
  font-weight: 700;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: white;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

.stats-band {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.stats-band div {
  flex: 1;
  min-width: 9rem;
  padding: 1rem;
  background: var(--surface);
}

.stats-band strong {
  display: block;
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1;
}

.stats-band span,
.save-state,
.viewer-count,
.video-meta,
.field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.toolbar {
  justify-content: flex-end;
}

.compact {
  width: min(18rem, 100%);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.video-card,
.post-panel,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.video-card {
  display: grid;
  overflow: hidden;
  min-width: 0;
}

.poster {
  min-height: 190px;
}

.poster[data-kind="dog"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--gold), transparent 20%), transparent),
    var(--surface-strong);
}

.poster[data-kind="cat"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--sky), transparent 10%), transparent),
    var(--surface-strong);
}

.poster[data-kind="bird"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 24%), transparent),
    var(--surface-strong);
}

.poster[data-kind="small-pet"] {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 25%), transparent),
    var(--surface-strong);
}

.pet-avatar {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 5rem;
  aspect-ratio: 1;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface), transparent 8%);
  color: var(--primary-strong);
  font-size: 2.6rem;
  font-weight: 900;
}

.badge {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 2;
  padding: 0.35rem 0.55rem;
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--text), transparent 12%);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.live {
  background: var(--accent);
  color: white;
}

.video-body {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.video-card h3 {
  font-size: 1.25rem;
}

.video-card p {
  margin: 0;
}

.video-card p:not(.video-meta) {
  color: var(--muted);
  line-height: 1.45;
}

.video-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.post-panel,
.settings-panel {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.post-panel h2,
.settings-panel h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.video-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  align-items: end;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field.wide {
  grid-column: span 2;
}

input,
select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.65rem 0.75rem;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary), transparent 62%);
  outline-offset: 2px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  color: var(--muted);
  font-weight: 800;
}

.toggle input {
  width: 1.15rem;
  min-height: 1.15rem;
  accent-color: var(--primary);
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.settings-panel {
  margin-bottom: 1rem;
}

.settings-grid {
  gap: 1rem;
}

.settings-grid .field {
  flex: 1;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer a {
  color: var(--primary);
}

@media (max-width: 960px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar,
  .hero,
  .stats-band,
  .settings-grid {
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    position: static;
  }

  .nav {
    overflow-x: auto;
  }

  .nav a {
    flex: 1;
  }

  .hero h2 {
    max-width: 10ch;
  }

  .video-grid,
  .video-form {
    grid-template-columns: 1fr;
  }

  .field.wide {
    grid-column: auto;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
