/* Neutral, embeddable layout — inherits host page fonts/colors where possible. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #222;
  background: #fff;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  margin-bottom: 1rem;
}

.url-bar {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.lang-picker {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.lang-picker select {
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font: inherit;
}

.url-bar input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
}

.url-bar button {
  padding: 0.5rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f5f5f5;
  font: inherit;
  cursor: pointer;
}

.url-bar button:hover {
  background: #eee;
}

.empty {
  margin: 0;
  color: #666;
}

.empty code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.media-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1rem;
  align-items: start;
}

.probe-player {
  position: fixed;
  left: 0;
  top: 0;
  width: 640px;
  height: 360px;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.probe-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  min-width: 0;
  overflow: hidden;
}

.player-frame iframe,
.player-frame #player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.now-playing a,
.item-copy a {
  color: inherit;
  text-decoration: none;
}

.now-playing a:hover,
.item-copy a:hover {
  text-decoration: underline;
}

.now-playing .meta,
.playlist-head span,
.item-copy .author,
.index {
  color: #666;
  font-size: 0.9em;
}

.playlist-pane {
  display: flex;
  flex-direction: column;
  /* Match row height from the 16:9 player without expanding it */
  height: 0;
  min-height: 100%;
  border: 1px solid #ddd;
  background: #fff;
  overflow: hidden;
}

.playlist-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #ddd;
  flex-shrink: 0;
}

.playlist-head-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.playback-toggles {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.2rem;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  background: linear-gradient(180deg, #fafafa 0%, #f2f2f2 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #555;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.toggle-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.toggle-btn:hover {
  background: #fff;
  border-color: #d8d8d8;
  color: #1a1a1a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.toggle-btn:active {
  transform: scale(0.95);
}

.toggle-btn:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

.toggle-btn[aria-pressed="true"] {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

.toggle-btn[aria-pressed="true"]:hover {
  background: #333;
  border-color: #333;
  color: #fff;
}

.status {
  margin: 0.5rem 0.75rem 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid #ddd;
  background: #fafafa;
  color: #444;
  font-size: 0.9em;
  flex-shrink: 0;
}

.status.error {
  border-color: #e0b4b4;
  background: #fff5f5;
  color: #8a1f1f;
}

.playlist {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.playlist-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.4rem;
  border-radius: 2px;
  cursor: pointer;
}

.playlist-item:hover {
  background: #f3f3f3;
}

.playlist-item.active {
  background: #e8e8e8;
}

.playlist-play {
  display: grid;
  grid-template-columns: 1.75rem 5.5rem;
  gap: 0.55rem;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.index {
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #ddd;
}

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

.item-copy {
  min-width: 0;
}

.item-copy .title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.3;
  color: #222;
}

.item-copy .author {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.embed .toolbar,
body.embed .empty {
  display: none;
}

body.embed .wrap {
  padding: 0;
  max-width: none;
}

body.embed .stage {
  margin: 0;
}

@media (max-width: 800px) {
  .media-row {
    grid-template-columns: 1fr;
  }

  .playlist-pane {
    height: min(50vh, 420px);
    min-height: 0;
  }

  .toolbar {
    flex-direction: column;
  }

  .url-bar {
    flex-direction: column;
  }
}
