
/* ==========================================================================
   ZOKOANIME EMBED PLAYER UI
   ========================================================================== */

/* The wrap (not the iframe) owns fullscreen so episode swaps keep it. */
#player-wrap {
  aspect-ratio: 16 / 9;
  background: #000;
}

#player-wrap:fullscreen {
  aspect-ratio: auto;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

#player-wrap iframe {
  border: none;
  display: block;
  width: 100%;
  height: 100%;
}

/* Loading spinner over the player */
.zoko-player-spinner {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  background: rgba(6, 7, 11, 0.72);
  backdrop-filter: blur(6px);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  /* Fixed light text, NOT var(--text-sub): the scrim is dark in BOTH themes,
     but light mode redefines --text-sub to dark grey (#4b5563) — that was
     the dark-on-dark unreadable "Loading stream…" (live-browser defect #3).
     The ring is lime in both themes, so only the text needed pinning. */
  color: #e5e7eb;
}

/* The label is a solid dark pill with light text, so it stays readable
   whatever poster art blurs through the scrim — in both themes. */
.zoko-player-spinner span {
  background: rgba(17, 20, 28, 0.94);
  color: #e5e7eb;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.zoko-player-spinner[hidden] {
  display: none;
}

/* The spinner ring itself (.zoko-spinner-ring + @keyframes zoko-spin) lives
   in zoro-aizen.css now — the shared stylesheet every page loads (fix #7:
   the detail page never loaded this file, so its spinner was invisible). */

/* Error / finished overlay */
.zoko-player-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 7, 11, 0.86);
  backdrop-filter: blur(8px);
}

.zoko-player-overlay[hidden] {
  display: none;
}

.zoko-overlay-card {
  text-align: center;
  max-width: 460px;
  background: var(--bg-surface, #14161f);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.09));
  border-radius: 14px;
  padding: 1.6rem 1.9rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.zoko-overlay-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.zoko-overlay-card p {
  font-size: 0.875rem;
  color: var(--text-sub, #b9bdc9);
  line-height: 1.55;
  margin-bottom: 1.1rem;
}

/* "Resumed from 12:34" note */
.zoko-resume-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--zoro-lime);
  background: rgba(202, 233, 98, 0.1);
  border: 1px solid rgba(202, 233, 98, 0.35);
}

.zoko-resume-note[hidden] {
  display: none;
}

/* Toasts */
.zoko-toasts {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.zoko-toast {
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(18, 20, 27, 0.94);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.09));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: zoko-toast-in 0.24s ease;
}

.zoko-toast-info {
  border-color: rgba(202, 233, 98, 0.45);
  color: var(--zoro-lime);
}

.zoko-toast-error {
  border-color: rgba(255, 96, 96, 0.55);
  color: #ff8f8f;
}

.zoko-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.3s ease;
}

@keyframes zoko-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Track switcher + settings toggles */
.zoko-control-bar {
  gap: 0.75rem;
}

/* Server switcher (Zoko primary | TVplus backup | MegaPlay alternate).
   Compact enough to fit a 390px-wide screen: label + three pills, wraps
   with the bar. */
.zoko-server-bar {
  margin-top: 0.75rem;
  padding: 0.5rem 0.9rem;
  gap: 0.6rem;
}

.zoko-server-bar .zoko-bar-label {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.zoko-server-bar .server-pill {
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
}

/* Track pills / settings the backup player cannot serve: greyed, honest
   tooltip, and hover must NOT light them up like an active pill. */
.server-pill.is-disabled,
.server-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.server-pill.is-disabled:hover,
.server-pill:disabled:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: inherit;
  box-shadow: none;
}

.zoko-toggle.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.zoko-toggle.is-disabled input {
  cursor: not-allowed;
}

/* Failure offer / backup status notice (inline, below the player). Amber
   alert styling distinct from the lime resume note; wraps on narrow screens. */
.zoko-fallback-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-size: 0.8rem;
  color: #ffd9a0;
  background: rgba(255, 176, 32, 0.08);
  border: 1px solid rgba(255, 176, 32, 0.4);
}

.zoko-fallback-note[hidden] {
  display: none;
}

.zoko-fallback-note .zoko-fallback-text {
  font-weight: 600;
}

.zoko-fallback-note .btn-zoro-primary {
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
}

.zoko-fallback-note .fallback-dismiss {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  /* 44px minimum tap target (fix #13): was a ~20px bare ✕. */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.zoko-bar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-sub, #b9bdc9);
}

.zoko-track-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ==========================================================================
   WATCH CONTROLS — one grouped card (2026-11-23)
   Server / Audio / Episode / Playback in a single clearly-labelled block,
   replacing the three scattered bars. Every control is at least 44px tall
   (the 23 Nov audit found 30–38px targets) and every row wraps, so nothing
   clips or overflows at 390px.
   ========================================================================== */
.watch-controls {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.25rem 1.25rem;
}

.watch-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
}

.watch-controls-row + .watch-controls-row {
  border-top: 1px solid var(--border-subtle);
}

.watch-controls-label {
  flex: 0 0 76px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--zoro-lime);
}

.watch-controls-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* 44px minimum tap targets inside the controls card only (site-wide pills
   and chips keep their existing sizes). */
.watch-controls .server-pill,
.watch-controls .genre-chip-zoro,
.watch-controls .btn-zoro-primary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.watch-controls .zoko-setting-toggles {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}

.watch-controls .zoko-toggle {
  min-height: 44px;
}

.watch-controls .zoko-toggle input {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .watch-controls {
    padding: 0.25rem 1rem;
  }
  .watch-controls-label {
    flex-basis: 100%;
  }
}

.zoko-setting-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-left: 0.35rem;
  padding-left: 0.85rem;
  border-left: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.09));
}

.zoko-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-sub, #b9bdc9);
  cursor: pointer;
  user-select: none;
}

.zoko-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--zoro-lime);
  cursor: pointer;
}

.zoko-toggle:hover {
  color: #fff;
}

@media (max-width: 720px) {
  .zoko-setting-toggles {
    width: 100%;
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }
}

/* Episode grid status text (loading / empty) */
.ep-grid-status {
  grid-column: 1 / -1;
  padding: 12px 0;
  font-size: 0.85rem;
  color: var(--text-muted, #8b8f9c);
}

/* Note: the watch-page data-error banner styles live in zoro-aizen.css, which
   is the stylesheet every page actually loads. */

/* Continue Watching row (home page) */
.zoko-continue-section {
  margin-bottom: 2.5rem;
}

.zoko-continue-card {
  display: block;
  text-decoration: none;
}

.zoko-continue-card .zoro-card-poster {
  position: relative;
}

.zoko-continue-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #0c0d12;
  background: var(--zoro-lime);
}

.zoko-continue-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.65);
}

.zoko-continue-bar span {
  display: block;
  height: 100%;
  background: var(--zoro-lime);
}

/* Light theme (fix #4, 23 Nov audit): this file had zero light overrides.
   The overlay card sits on a light surface in light mode, so its hardcoded
   white title was invisible (1.00:1); the lime resume note and amber
   fallback note were ~1.2:1. Darkened to the same #4d7c0f / #92400e the
   main stylesheet uses for light-mode accents. */
[data-theme="light"] .zoko-overlay-card h3 { color: var(--text-main); }
[data-theme="light"] .zoko-resume-note {
  color: #4d7c0f;
  background: rgba(77, 124, 15, 0.1);
  border-color: rgba(77, 124, 15, 0.4);
}
[data-theme="light"] .zoko-fallback-note {
  color: #92400e;
  background: rgba(255, 176, 32, 0.12);
  border-color: rgba(180, 120, 10, 0.45);
}
