:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #222222;
  --muted: #666666;
  --line: #cccccc;
  --accent: #086888;
  --accent-strong: #075a76;
  --danger: #b42318;
  --ok: #16794c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: var(--accent);
}

.site-header,
.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 16px;
  font-size: 0.95rem;
}

.page-shell {
  padding-top: 20px;
  padding-bottom: 48px;
}

.watch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

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

.player-frame {
  aspect-ratio: 16 / 9;
  background: #000000;
}

.player-frame video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000000;
}

.video-meta {
  padding: 16px;
}

.video-meta h1,
.panel h2,
.form-card h2 {
  margin: 0 0 8px;
  line-height: 1.3;
}

.video-meta p,
.muted {
  color: var(--muted);
}

.panel {
  padding: 16px;
}

.video-list {
  display: grid;
  gap: 10px;
}

.video-card {
  width: 100%;
  padding: 0;
  overflow: hidden;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.video-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #e4e4e4;
}

.video-card-body {
  padding: 10px 12px 12px;
}

.video-card-title {
  display: block;
  font-weight: 700;
}

.video-card[aria-current="true"] {
  border-color: var(--accent);
  outline: 1px solid var(--accent);
}

.status {
  min-height: 1.6em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}

.form-grid {
  display: grid;
  gap: 20px;
}

.form-card {
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--bg);
  font-size: 0.85rem;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--accent);
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
}

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

button.secondary:hover {
  background: var(--bg);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

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

.embed-body {
  min-height: 100vh;
  background: #000000;
}

.embed-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 0;
}

.embed-player {
  width: 100%;
}

.embed-player video {
  display: block;
  width: 100%;
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  background: #000;
}

.embed-status {
  position: fixed;
  right: 12px;
  bottom: 12px;
  max-width: min(520px, calc(100% - 24px));
  margin: 0;
  padding: 8px 12px;
  background: rgb(0 0 0 / 0.78);
  color: #fff;
  font-size: 0.9rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .watch-layout,
  .two-column {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --surface: #1f1f1f;
    --text: #eeeeee;
    --muted: #aaaaaa;
    --line: #444444;
    --accent: #4db8d8;
    --accent-strong: #78cbe5;
  }
}
