:root {
  color-scheme: dark;
  --bg: #111314;
  --panel: #1b1f21;
  --panel-strong: #242a2d;
  --text: #f3f6f4;
  --muted: #a8b1ad;
  --line: #384044;
  --accent: #48c78e;
  --accent-strong: #7bdff2;
  --danger: #f87171;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 24px;
}

.library,
.player-area {
  min-width: 0;
}

.library {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 48px);
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

h2 {
  overflow-wrap: anywhere;
  font-size: 1.1rem;
  line-height: 1.3;
}

#library-summary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.field-label,
.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.control {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #121617;
  color: var(--text);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.control:focus,
button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.vod-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  padding-top: 4px;
}

.vod-item {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.vod-item:hover {
  background: var(--panel-strong);
}

.vod-item[aria-current="true"] {
  border-color: rgba(72, 199, 142, 0.8);
  background: rgba(72, 199, 142, 0.14);
}

.player-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.video-player {
  width: 100%;
  max-height: calc(100vh - 146px);
  min-height: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000;
  box-shadow: var(--shadow);
}

.now-playing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-button,
.secondary-button,
.icon-button,
.context-menu button {
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.secondary-button {
  display: inline-grid;
  min-height: 42px;
  min-width: 42px;
  padding: 9px 11px;
  place-items: center;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.secondary-button:hover,
.secondary-button[aria-pressed="true"] {
  border-color: rgba(72, 199, 142, 0.65);
  background: rgba(72, 199, 142, 0.14);
}

.secondary-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.download-button {
  padding-inline: 13px;
}

.primary-button {
  min-height: 40px;
  padding: 9px 13px;
  background: var(--accent);
  color: #06130d;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button:hover {
  background: #69d8a5;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 1.25rem;
}

.notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(320px, calc(100vw - 36px));
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  box-shadow: var(--shadow);
}

.notice-error {
  border: 1px solid rgba(248, 113, 113, 0.55);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.notice-info {
  border: 1px solid rgba(123, 223, 242, 0.45);
  background: rgba(123, 223, 242, 0.1);
  color: #d9f7ff;
}

.notice-success {
  border: 1px solid rgba(72, 199, 142, 0.65);
  background: #48c78e;
  color: #06130d;
}

.context-menu {
  position: fixed;
  z-index: 10;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: var(--shadow);
}

.context-menu button {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  background: transparent;
  color: #111827;
  text-align: left;
}

.context-menu button:hover {
  background: #e5e7eb;
}

.empty-state {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    padding: 14px;
    overflow: visible;
  }

  .library {
    max-height: none;
    overflow: visible;
  }

  .vod-list {
    flex: none;
    max-height: 45vh;
    min-height: 180px;
  }

  .video-player {
    min-height: 220px;
    max-height: none;
  }

  .now-playing {
    align-items: stretch;
    flex-direction: column;
  }

  .player-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

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

  .secondary-button {
    width: 100%;
  }

  .order-button {
    width: 100%;
  }

  .notice {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}
