:root {
  color-scheme: light;
  --bg: #f7f7f3;
  --panel: #ffffff;
  --text: #1d2522;
  --muted: #66736d;
  --line: #d9dfda;
  --accent: #0d7a61;
  --accent-strong: #095a48;
  --danger: #9c2f2f;
  --sidebar-width: 260px;
  --content-width: 42vw;
  --splitter-width: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

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

.is-hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 480px);
}

.gate-visual {
  min-height: 100vh;
  overflow: hidden;
}

.gate-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gate-panel {
  align-self: center;
  padding: 40px;
}

.gate-panel h1 {
  margin: 0;
  font-size: 2.1rem;
}

.gate-panel form {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.gate-panel input,
.filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

.notice {
  color: var(--danger);
  min-height: 1.4em;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns:
    minmax(200px, var(--sidebar-width))
    var(--splitter-width)
    minmax(320px, var(--content-width))
    var(--splitter-width)
    minmax(360px, 1fr);
  height: 100vh;
  overflow: hidden;
}

.shell.is-resizing {
  cursor: col-resize;
  user-select: none;
}

.sidebar {
  background: #f0f4ef;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  overflow: auto;
}

.splitter {
  width: var(--splitter-width);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--line);
  cursor: col-resize;
}

.splitter:hover,
.splitter:focus-visible {
  background: var(--accent);
}

.sidebar h1,
.toolbar h2,
.detail h2 {
  margin: 0;
}

.streamer-list {
  display: grid;
  gap: 8px;
}

.streamer-button,
.secondary-button {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  text-align: left;
}

.streamer-button[aria-current="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.secondary-button {
  margin-top: auto;
  text-align: center;
}

.content {
  padding: 22px;
  overflow: auto;
  min-width: 0;
}

.toolbar {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  align-items: end;
}

.filters label {
  font-size: 0.82rem;
  color: var(--muted);
}

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

.chapter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.chapter-header {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.chapter-header h3 {
  margin: 0 0 4px;
}

.video-list {
  display: grid;
}

.video-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.video-row .chips {
  grid-column: 2;
}

.video-row:last-child {
  border-bottom: 0;
}

.video-row:hover,
.video-row:focus-visible,
.video-row[aria-current="true"] {
  background: #edf6f2;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 2px 6px;
}

.detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.player-stage {
  background: #111;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: hidden;
}

.player-surface {
  width: 100%;
  height: 100%;
  aspect-ratio: 9 / 16;
  background: #050505;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
}

.player-surface .artplayer {
  width: 100% !important;
  height: 100% !important;
}

.detail-body {
  padding: 22px;
  overflow: auto;
  min-height: 0;
}

.drive-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-strong);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.detail-actions .secondary-button {
  width: auto;
  min-width: 92px;
  margin-top: 0;
  text-align: center;
}

.detail-actions .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.summary-panel {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.summary-panel h3 {
  margin: 0 0 10px;
}

.summary-panel ul {
  padding-left: 20px;
}

@media (max-width: 980px) {
  .gate,
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .gate-visual {
    min-height: 30vh;
    max-height: 36vh;
  }

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

  .content {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .splitter {
    display: none;
  }

  .detail {
    grid-template-rows: auto auto;
    min-height: 0;
    overflow: visible;
  }

  .player-stage {
    min-height: 0;
    padding: 12px;
  }

  .player-surface {
    width: 100%;
    height: auto;
    max-height: 74vh;
  }

  .video-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .gate-panel,
  .content,
  .detail-body,
  .sidebar {
    padding: 16px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

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

  .video-row .chips {
    grid-column: 1;
  }

  .detail-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
}
