/* "X's Library" — someone else's Hearth inside the Cinema (media/cinema-shared.js,
   the shared view in media/cinema.js). Same screening-room tokens as cinema.css. */

/* A person without a picture: their initial on a tile tinted from their name. */
.cshare-initial {
  --cshare-hue: 35;
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  font-weight: 750; font-size: 15px; line-height: 1; color: #fff8ec; letter-spacing: 0;
  background: radial-gradient(120% 120% at 30% 20%, hsl(var(--cshare-hue) 62% 52%), hsl(calc(var(--cshare-hue) + 28) 55% 26%));
  box-shadow: inset 0 0 0 1px rgba(255, 240, 214, .22), 0 2px 8px -2px rgba(0, 0, 0, .6);
}
.cinema-library-initial { width: 34px; height: 34px; font-size: 16px; }
/* cinema.css hides the pill's words on a phone (`.cinema-library span`); the face stays. */
.cinema-library .cinema-library-initial { display: inline-grid !important; }
.cinema-library.is-shared { box-shadow: inset 0 0 0 1px rgba(237, 199, 141, .55); }

/* The library menu: group headings, the current library, the two sharing actions. */
.cinema-libmenu-group { padding: 12px 10px 4px; font-size: 10.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--cinema-accent); list-style: none; }
.cinema-libmenu-opt.is-current { box-shadow: inset 3px 0 0 var(--cinema-accent); }
.cinema-libmenu-opt.is-current .cinema-libmenu-t b::after { content: ' · open'; font-weight: 500; color: var(--cinema-muted); }
.cinema-libmenu-opt.is-action .cinema-libmenu-t b { color: var(--cinema-accent); }
.cinema-libmenu-opt .cshare-initial { width: 32px; height: 32px; }

/* The band that says whose library this is. */
.cinema-shared-band {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  margin: 18px var(--cinema-gutter) 4px; padding: 16px 20px; border-radius: 14px;
  background: linear-gradient(100deg, rgba(237, 199, 141, .13), rgba(25, 29, 37, .4) 55%, transparent);
  border: 1px solid rgba(237, 199, 141, .24);
}
.cinema-shared-face { width: 56px; height: 56px; font-size: 24px; }
.cinema-shared-words { min-width: 0; }
.cinema-shared-words h2 { margin: 4px 0 2px; font-size: clamp(20px, 2vw, 26px); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.cinema-shared-sub { margin: 0; color: var(--cinema-muted); font-size: 13px; line-height: 1.5; text-wrap: pretty; overflow-wrap: anywhere; }
.cinema-shared-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.cinema-shared-acts .cinema-button { white-space: nowrap; }
.cinema-shared-remove[data-armed="1"] { color: #ffd9cf; border-color: rgba(255, 128, 100, .6); background: rgba(120, 30, 20, .55); }

/* "See all": one library in full. */
.cinema-shared-gridhead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 22px var(--cinema-gutter) 8px; }
.cinema-shared-gridtitle { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1; }
.cinema-shared-gridtitle h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cinema-shared-count { color: var(--cinema-muted); font-size: 13px; white-space: nowrap; }
.cinema-shared-sort { display: inline-flex; align-items: center; gap: 8px; color: var(--cinema-muted); font-size: 13px; }
.cinema-shared-sort select {
  min-height: 40px; padding: 6px 30px 6px 12px; border-radius: 8px; border: 1px solid var(--cinema-line); color: var(--cinema-ink);
  background: #1b2029; font: inherit; font-size: 14px;
}
.cinema-shared-sort select:focus-visible { outline: 2px solid var(--cinema-accent); outline-offset: 2px; }
.cinema-shared-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(132px, 12vw, 190px), 1fr)); gap: 26px 18px;
  margin: 14px var(--cinema-gutter) 0;
}
.cinema-shared-grid .cinema-slot { flex: none; width: auto; }
.cinema-shared-more { display: flex; margin: 30px auto 0; }

/* A title's popout: the episode list. */
.cinema-shared-dialog .cinema-detail-availability { justify-content: flex-start; }
.cinema-shared-dialog .cinema-availability { flex: 1 1 100%; margin: 0; }
.cinema-shared-episodes { margin-top: 22px; }
.cinema-shared-seasonbar { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.cinema-shared-seasonbar h3 { margin: 0; }
.cinema-shared-seasons { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 2px; }
.cinema-shared-season {
  min-height: 38px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--cinema-line); background: transparent;
  color: var(--cinema-muted); cursor: pointer; white-space: nowrap; font-size: 13px !important; font-weight: 650;
}
.cinema-shared-season[aria-selected="true"] { color: #241b0e; background: var(--cinema-accent); border-color: transparent; }
.cinema-shared-eplist { list-style: none; margin: 0; padding: 0; }
.cinema-shared-eplist li { border-bottom: 1px solid var(--cinema-line); }
.cinema-shared-ep {
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px; align-items: start; width: 100%;
  padding: 12px 6px; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; border-radius: 10px;
  transition: background-color .16s ease;
}
.cinema-shared-ep:hover, .cinema-shared-ep:focus-visible { background: rgba(237, 199, 141, .08); }
.cinema-shared-ep-shot { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #1b2029; }
.cinema-shared-ep-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cinema-shared-ep-shot .cinema-progress { position: absolute; left: 0; right: 0; bottom: 0; }
.cinema-shared-ep-words { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cinema-shared-ep-words strong { font-size: 15px; overflow-wrap: anywhere; }
.cinema-shared-ep-words small { color: var(--cinema-muted); font-size: 12.5px; }
.cinema-shared-ep-sum { color: var(--cinema-muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* The two popouts: adding a share and making one. */
.cshare-dialog { width: min(560px, calc(100vw - 32px)); }
.cshare-dialog-wide { width: min(680px, calc(100vw - 32px)); }
.cshare-body { padding: 26px 26px 24px; }
.cshare-x {
  position: sticky; float: right; top: 14px; margin: 14px 14px -58px 0; z-index: 2; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--cinema-line); background: #1b2029cc; color: var(--cinema-ink); cursor: pointer;
}
.cshare-head { display: flex; gap: 16px; align-items: flex-start; padding-right: 48px; margin-bottom: 20px; }
.cshare-head-ico { width: 56px; height: 56px; object-fit: contain; flex: none; }
.cshare-head h2 { margin: 2px 0 6px; font-size: 22px; letter-spacing: -.02em; text-wrap: balance; }
.cshare-head p { margin: 0; color: var(--cinema-muted); font-size: 14px; line-height: 1.55; text-wrap: pretty; max-width: 60ch; }
.cshare-form { display: flex; flex-direction: column; gap: 16px; }
.cshare-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--cinema-muted); }
.cshare-field input, .cshare-field textarea, .cshare-code {
  width: 100%; padding: 11px 13px; border-radius: 9px; border: 1px solid var(--cinema-line); background: #10141b; color: var(--cinema-ink);
  font: inherit; font-size: 16px; font-weight: 450; resize: vertical;
}
.cshare-field textarea, .cshare-code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 14px; overflow-wrap: anywhere; line-break: anywhere; }
.cshare-field input:focus, .cshare-field textarea:focus, .cshare-code:focus { outline: none; border-color: var(--cinema-accent); box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.cshare-cap select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--cinema-line); background: #10141b; color: var(--cinema-ink); font: inherit; font-size: 15px; }
.cshare-cap small { font-weight: 450; font-size: 12.5px; }
.cshare-peek { margin: -8px 0 0; color: var(--cinema-accent); font-size: 13px; overflow-wrap: anywhere; }
.cshare-libs { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* An odd last library takes the whole row: no half-empty row. */
.cshare-lib:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
.cshare-libs legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 650; color: var(--cinema-muted); }
.cshare-lib { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--cinema-line); cursor: pointer; }
.cshare-lib:has(input:checked) { border-color: rgba(237, 199, 141, .55); background: rgba(237, 199, 141, .07); }
.cshare-lib input { width: 18px; height: 18px; accent-color: var(--cinema-accent); flex: none; }
.cshare-lib img { width: 32px; height: 32px; object-fit: contain; flex: none; }
.cshare-lib span { display: flex; flex-direction: column; min-width: 0; }
.cshare-lib b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cshare-lib small { color: var(--cinema-muted); font-size: 12px; }
.cshare-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.cshare-status { margin: 0; font-size: 13.5px; color: var(--cinema-muted); }
.cshare-status.is-bad { color: #ffb4a3; }
.cshare-help { margin: 16px 0 0; color: var(--cinema-muted); font-size: 13px; line-height: 1.55; text-wrap: pretty; }
.cshare-result { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--cinema-line); display: flex; flex-direction: column; gap: 12px; }
.cshare-result h3, .cshare-people h3 { margin: 0; font-size: 15px; }
.cshare-people { margin-top: 22px; }
.cshare-people:empty { display: none; }
.cshare-people ul { list-style: none; margin: 10px 0 0; padding: 0; }
.cshare-people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--cinema-line); }
.cshare-people li > span:not(.cshare-initial) { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cshare-people b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cshare-people small { color: var(--cinema-muted); font-size: 12px; }
.cshare-stop { min-height: 40px; padding: 8px 14px; white-space: nowrap; }
.cshare-stop[data-armed="1"] { color: #ffd9cf; border-color: rgba(255, 128, 100, .6); }

/* Outside .cinema, cinema.css's own [hidden] rule does not reach: a hidden button stays hidden. */
.cshare-player [hidden], .cshare-dialog [hidden] { display: none !important; }

/* The player: the whole window, the title over the top edge. */
.cshare-player {
  position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #000; color: #f4f0e9; overflow: hidden;
}
.cshare-player::backdrop { background: #000; }
.cshare-video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.cshare-player-bar {
  position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 28px; background: linear-gradient(#000c, transparent);
  transition: opacity .25s ease;
}
.cshare-player:not(:hover) .cshare-player-bar:not(:focus-within) { opacity: .0; }
@media (hover: none) { .cshare-player-bar { opacity: 1 !important; } }
.cshare-player-words { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cshare-player-words strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cshare-player-words small { color: #c9c3b8; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cshare-quality { min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1px solid #ffffff33; background: #000a; color: inherit; font: inherit; font-size: 14px; }
.cshare-next { min-height: 40px; padding: 8px 14px; white-space: nowrap; }
.cshare-player .cshare-x { position: static; float: none; margin: 0; background: #000a; border-color: #ffffff33; color: #fff; }
.cshare-player-note {
  position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px));
  margin: 0; padding: 10px 16px; border-radius: 10px; background: #0d1016e6; color: #e9e3d8; font-size: 14px; text-align: center; text-wrap: pretty;
}
.cshare-player-note.is-bad { color: #ffc2b4; }

@media (max-width: 720px) {
  .cinema-shared-band { grid-template-columns: auto minmax(0, 1fr); padding: 14px; gap: 14px; }
  .cinema-shared-acts { grid-column: 1 / -1; justify-content: stretch; }
  .cinema-shared-acts .cinema-button { flex: 1; }
  .cinema-shared-face { width: 46px; height: 46px; font-size: 20px; }
  .cinema-shared-ep { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
  .cshare-body { padding: 22px 18px 20px; }
  .cshare-libs { grid-template-columns: 1fr; }
  .cshare-actions .cinema-button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .cinema-shared-ep, .cshare-player-bar { transition: none; } }

/* A title you do not own that a friend's Hearth has: the "In your library" tag, in brass. */
.cinema-owned.cinema-on-shared { background: rgba(237, 199, 141, .92); color: #241b0e; }
/* The band's name, renamed in place. */
.cinema-shared-rename {
  margin: 4px 0 2px; width: min(420px, 100%); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--cinema-accent);
  background: #10141b; color: var(--cinema-ink); font: inherit; font-size: clamp(20px, 2vw, 26px); font-weight: 700; letter-spacing: -.02em;
}
.cinema-shared-rename:focus { outline: none; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
/* Seasons and the season's "Mark watched", on one row that wraps. */
.cinema-shared-seasontools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; justify-content: space-between; }
.cinema-shared-seasonmark { white-space: nowrap; }
/* An episode you have seen: its still dims and says so. */
.cinema-shared-ep.is-seen .cinema-shared-ep-shot img { opacity: .55; }
.cinema-shared-seen {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 750;
  color: #241b0e; background: var(--cinema-accent); letter-spacing: .02em;
}
/* A shelf's link ("Open ›", "See all 42 ›") stays one unit beside a long friend's name. */
.cinema-shelf-heading .cinema-text-button { white-space: nowrap; flex: none; }
.cinema-shelf-heading h2 { min-width: 0; overflow-wrap: anywhere; }
