/* ----------------------------------------------------------------------- */
/*  4both — watching together                                              */
/*  The same neutral ramp as the call: a film is watched in the dark, and   */
/*  anything bright around it is a light left on in the room.               */
/* ----------------------------------------------------------------------- */

:root {
  --bg: #0a0a0a;
  --sunken: #101010;
  --panel: #171717;
  --surface: #242424;
  --surface-hi: #343434;
  --line: #2e2e2e;
  --text: #e8e8e8;
  --muted: #898989;
  --bright: #f3f3f3;
  --ok: #81a287;
  --wait: #bea87c;
  --bad: #bd766e;
  --edge: rgba(255, 255, 255, 0.1);

  --r-card: 26px;
  --r-pad: 16px;
  --r-inner: 10px;

  color-scheme: dark;
}

/* A grid or flex rule would otherwise win against the attribute, and the
   section would stay on screen while claiming to be hidden. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  padding: 16px;
}

h1 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }

.lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; }

/* ------------------------------ the password ----------------------------- */

.card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: var(--r-card);
  padding: var(--r-pad);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.field { display: block; margin-bottom: 12px; }
.field span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="password"], input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--r-inner);
  background: var(--sunken);
  color: var(--text);
  font: inherit;
}
input:focus-visible { outline: 2px solid var(--surface-hi); outline-offset: 2px; }

button {
  font: inherit;
  border: 0;
  border-radius: var(--r-inner);
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  padding: 12px 16px;
}
button:hover:not(:disabled) { background: var(--surface-hi); }
button:disabled { opacity: 0.45; cursor: default; }

.primary {
  width: 100%;
  background: var(--bright);
  color: #0a0a0a;
  font-weight: 600;
  margin-top: 4px;
}
.primary:hover:not(:disabled) { background: #fff; }

.error {
  margin: 12px 0 0;
  color: var(--bad);
  font-size: 13px;
}

/* -------------------------------- the shelf ------------------------------ */

#shelf {
  width: min(680px, 100%);
  background: var(--panel);
  border-radius: var(--r-card);
  padding: var(--r-pad);
}

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.bar h2 { margin-right: auto; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.episode {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-align: left;
  background: var(--sunken);
  padding: 14px 16px;
}
.episode:hover:not(:disabled) { background: var(--surface); }
.episode-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.episode-note { color: var(--muted); font-size: 12px; flex: none; }

.empty { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ------------------------------- the player ------------------------------ */

#watch {
  width: min(1200px, 100%);
  display: grid;
  gap: 10px;
}

.tap {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  border: 0;
  cursor: pointer;
}
.tap:hover { background: rgba(0, 0, 0, 0.85); }

.stage {
  position: relative;
  background: #000;
  border-radius: var(--r-inner);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--edge);
}

video {
  display: block;
  width: 100%;
  /* Fitted, never cropped: a film has its own shape and losing the edges of
     it to fill a window is worse than a band of black. */
  max-height: calc(100vh - 120px);
  object-fit: contain;
  background: #000;
}

#watch .bar { margin: 0; }

.title {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status { font-size: 12px; color: var(--muted); flex: none; }
.status[data-state="ok"] { color: var(--ok); }
.status[data-state="wait"] { color: var(--wait); }

.ghost { background: transparent; color: var(--muted); padding: 8px 10px; }
.ghost:hover { background: var(--surface); color: var(--text); }

@media (max-width: 560px) {
  body { padding: 10px; }
  .bar { flex-wrap: wrap; }
  .title { order: 3; width: 100%; }
}
