:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66727c;
  --line: #dfe5e8;
  --accent: #0b6e69;
  --accent-dark: #084f4b;
  --warn: #a44c00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary,
.tab {
  background: #e8eeee;
  color: var(--ink);
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 0 12px;
  width: 100%;
}

.shell {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 1280px;
  padding: 20px;
}

.topbar,
.workspace,
.reader,
.library {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 560px);
  padding: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
}

.import-form {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 104px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 680px;
  overflow: hidden;
}

.library {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
}

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

.video-item {
  align-items: start;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 8px;
  grid-template-columns: 96px 1fr;
  min-height: 86px;
  padding: 8px;
  text-align: left;
}

.video-item.active {
  border-color: var(--accent);
}

.video-item img {
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  object-fit: cover;
  width: 96px;
}

.video-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.video-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.reader {
  border: 0;
  border-radius: 0;
  min-width: 0;
  padding: 18px;
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  min-height: 440px;
  justify-content: center;
  text-align: center;
}

.hidden {
  display: none;
}

.video-header {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 160px 1fr;
}

.video-header img {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  width: 160px;
}

.video-header h2 {
  font-size: 22px;
  line-height: 1.25;
  margin-bottom: 6px;
}

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

.tabs,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.content-panel {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
  margin: 16px 0 0;
  min-height: 400px;
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
}

.status {
  background: #172026;
  border-radius: 7px;
  bottom: 18px;
  color: #fff;
  left: 50%;
  max-width: min(720px, calc(100vw - 32px));
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  transition: opacity 160ms ease;
}

.status.visible {
  opacity: 1;
}

.status.warn {
  background: var(--warn);
}

@media (max-width: 820px) {
  .topbar,
  .workspace,
  .import-form,
  .video-header {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
  }

  .library {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 320px;
  }
}
