:root {
  --plexiz-red: #ff3356;
  --plexiz-dark: #333333;
  --pentair-blue: #0068b5;
  --bg: #1a1a1a;
  --bg-soft: #232323;
  --card: #2b2b2b;
  --text: #ffffff;
  --muted: #bcbcbc;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-card: 12px;
  --radius-btn: 8px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --touch: 44px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

.page-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: padding 0.2s ease, min-height 0.2s ease;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 22px;
}

.brand-logo.pentair {
  height: 24px;
}

.topbar-meta {
  text-align: right;
  font-size: 0.78rem;
  color: var(--muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.set-chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.set-chip:active {
  background: rgba(255, 255, 255, 0.2);
}

.topbar.topbar-compact .brand-row {
  display: none;
}

.topbar.topbar-compact {
  min-height: 32px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.topbar.topbar-compact .topbar-meta,
.topbar.topbar-compact .topbar-right {
  font-size: 13px;
}

.shoot-clock {
  position: relative;
  z-index: 9;
  background: var(--bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 16px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Inline clock variants — no bar, inherits parent layout */
.shoot-clock.index-clock,
.shoot-clock.control-clock,
.shoot-clock.director-clock,
.shoot-clock.inline-clock {
  position: static;
  z-index: auto;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  text-align: left;
}

.shoot-clock.index-clock {
  display: inline;
  font-size: inherit;
  text-align: inherit;
}

.shoot-clock.director-clock {
  padding-top: 4px;
  font-size: 12px;
}

.shoot-clock.inline-clock {
  padding-bottom: 8px;
  font-size: 13px;
}

.shoot-clock.is-active {
  color: var(--success);
}

.shoot-clock.is-overtime {
  color: var(--warning);
}

.page {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: var(--space-3);
}

.page h1 {
  margin: 0 0 var(--space-2);
  font-size: 1.45rem;
  line-height: 1.2;
}

.page p {
  margin: 0;
  color: var(--muted);
}

.section {
  margin-top: var(--space-4);
}

.section-title {
  margin: 0 0 var(--space-2);
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.collapsible-header {
  width: 100%;
  min-height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--card);
  border-radius: var(--radius-card);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.collapsible-header .chevron {
  transition: transform 0.2s;
  color: var(--muted);
}

.collapsible-header.is-expanded .chevron {
  transform: rotate(90deg);
}

.collapsible-header.is-complete {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.16);
  color: #dcfce7;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: var(--space-3);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.card + .card {
  margin-top: var(--space-2);
}

.btn {
  min-height: var(--touch);
  border: 0;
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
}

.btn-primary {
  background: var(--plexiz-red);
}

.btn-secondary {
  background: var(--pentair-blue);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.26);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.1);
}

.status-chip.online {
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.45);
}

.status-chip.offline {
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.status-chip.error {
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: var(--touch);
}

.check-item input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--plexiz-red);
}

.muted {
  color: var(--muted);
}

.kicker {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Index */

.index-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-4) var(--space-3);
}

.index-title {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
}

.index-subtitle {
  margin-top: var(--space-1);
  color: var(--muted);
}

.role-grid {
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.role-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.15rem;
  font-weight: 700;
}

.role-link.primary {
  background: var(--plexiz-red);
  border-color: transparent;
}

.role-link.secondary {
  background: var(--pentair-blue);
  border-color: transparent;
}

.role-link.small {
  min-height: 50px;
  font-size: 0.95rem;
}

/* Director */

.director-main {
  padding-top: 0;
}

.director-main .section {
  margin-top: var(--space-2);
}

.director-main .section:first-child {
  margin-top: 0;
}

/* Director page: no sticky headers (they overlap on long scroll) */
.director-layout .topbar,
.progress-counter {
  position: relative;
  z-index: 10;
  margin-top: 0;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 10px;
}

.progress-counter-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-counter-labels {
  display: grid;
  gap: 2px;
}

.progress-counter-labels p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.progress-counter-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.counter-item {
  display: grid;
}

.counter-track {
  height: 6px;
  border-radius: 999px;
  background: var(--card);
  overflow: hidden;
}

.counter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
  transition: width 180ms ease;
}

.pre-shoot-card.is-collapsed {
  padding: var(--space-2);
}

.checklist-collapsed {
  width: 100%;
  min-height: var(--touch);
  border-radius: var(--radius-btn);
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.16);
  color: #d7fbe5;
  font: inherit;
  font-weight: 700;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

#brollContainer,
#equipoBrollContainer {
  margin-top: 10px;
}

.recorded-list {
  display: grid;
  gap: var(--space-2);
}

.director-video-card,
.broll-row {
  display: grid;
  gap: 10px;
  transition: background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.director-video-card.is-recorded,
.broll-row.is-captured {
  border-left: 4px solid var(--success);
  padding-left: calc(var(--space-3) - 4px);
}

.director-video-card.is-recorded {
  background: rgba(34, 197, 94, 0.05);
}

.director-video-card.is-current {
  border-color: rgba(0, 104, 181, 0.72);
  box-shadow:
    0 0 0 1px rgba(0, 104, 181, 0.32),
    var(--shadow);
}

.record-item-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.director-video-priority {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.48);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fecaca;
  white-space: nowrap;
  margin: 0;
}

.director-video-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.director-video-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.director-video-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  line-height: 1;
}

.director-recorded-badge {
  font-size: 18px;
  line-height: 1;
}

.director-video-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.director-btn-teleprompter {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(188, 188, 188, 0.55);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.director-btn-record {
  width: 100%;
  min-height: 52px;
  border-radius: 10px;
  border: 2px solid rgba(188, 188, 188, 0.72);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.director-btn-record.is-recorded {
  border-color: rgba(34, 197, 94, 0.55);
  color: #d7fbe5;
}

.director-quality-wrap {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease, max-height 150ms ease;
}

.director-quality-wrap.is-visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 240px;
  pointer-events: auto;
}

.director-quality-prompt {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.director-quality-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.director-quality-btn {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.director-quality-btn.is-good {
  border-color: rgba(34, 197, 94, 0.55);
  color: #dcfce7;
}

.director-quality-btn.is-retake {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fcd34d;
}

.director-quality-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  animation: qualityFadeIn 150ms ease;
}

.director-quality-chip {
  min-height: 34px;
  border-radius: 16px;
  border: 1px solid rgba(188, 188, 188, 0.6);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}

.director-unrecord-link {
  margin-top: 2px;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

.director-quality-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.director-quality-badge.is-good {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #dcfce7;
}

.director-quality-badge.is-retake {
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fef3c7;
}

.broll-toggle {
  width: 100%;
  min-height: 56px;
  border-radius: 10px;
  border: 1px solid rgba(188, 188, 188, 0.5);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.broll-toggle.is-captured {
  border-color: transparent;
  background: var(--success);
  color: #fff;
}

.broll-toggle.pulse {
  animation: recordPulse 280ms ease;
}

@keyframes qualityFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.sync-flash {
  border-color: rgba(34, 197, 94, 0.74) !important;
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.24),
    var(--shadow);
}

@keyframes recordPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

.director-fab {
  position: fixed;
  bottom: 24px;
  right: 16px;
  z-index: 20;
  min-height: 56px;
  background: var(--plexiz-red);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.director-fab:active {
  transform: scale(0.95);
}

/* Talento */

.talento-wrap {
  display: grid;
  gap: var(--space-3);
}

.talento-focus {
  background: linear-gradient(180deg, #2a2a2a 0%, #222222 100%);
}

.talento-title {
  margin: 8px 0;
  font-size: 1.6rem;
  line-height: 1.2;
}

.delivery-chip {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 800;
}

.delivery-chip-teleprompter {
  background: var(--pentair-blue);
  color: #fff;
  border: 1px solid rgba(0, 104, 181, 0.9);
}

.delivery-chip-camera {
  background: var(--plexiz-red);
  color: #fff;
  border: 1px solid rgba(255, 51, 86, 0.9);
}

.delivery-chip-voiceover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.delivery-subtitle {
  margin-top: 8px !important;
  font-size: 0.92rem;
  color: #fde68a;
  font-weight: 700;
}

.key-phrases {
  margin: var(--space-2) 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.key-phrases li {
  font-size: 1.08rem;
  line-height: 1.35;
}

.talento-controls {
  display: flex;
  gap: 10px;
}

.talento-controls .btn {
  flex: 1;
}

.swipe-tip {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.talento-focus .muted {
  white-space: pre-line;
  line-height: 1.5;
}

.talento-script-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.talento-script-actions .btn {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.95rem;
}

.talento-editor {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.talento-editor textarea {
  min-height: 220px;
  line-height: 1.45;
}

.script-reset-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fda4af;
  text-decoration: underline;
}

.talento-sync-banner {
  border-radius: 10px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.16);
  color: #dcfce7;
  padding: 10px 12px;
  font-size: 0.96rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 180ms ease;
}

.talento-sync-banner.is-visible {
  opacity: 1;
}

.talento-synced {
  animation: talentSyncFlash 0.6s ease;
}

.talento-script-toggle {
  padding: 12px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.talento-script-toggle:active {
  color: var(--text);
}

.talento-full-script {
  margin-top: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-btn);
  border-left: 3px solid var(--pentair-blue);
}

.talento-script-text {
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--text);
  margin: 0;
}

@keyframes talentSyncFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* Equipo */

.equipo-grid {
  display: grid;
  gap: var(--space-3);
}

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

.shot-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 10px;
}

.shot-item input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  accent-color: var(--plexiz-red);
}

.shot-meta {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--muted);
}

.equipo-now-shooting {
  background: var(--card);
  border-left: 4px solid var(--plexiz-red);
  border-radius: var(--radius-card);
  padding: 12px 16px;
}

.equipo-now-shooting.is-active {
  border-left-color: var(--success);
}

.now-shooting-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--plexiz-red);
  font-weight: 700;
  margin-bottom: 4px;
}

.equipo-now-shooting.is-active .now-shooting-label {
  color: var(--success);
}

.now-shooting-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.now-shooting-notes {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-line;
}

.setup-notes-card {
  background: rgba(0, 104, 181, 0.08);
  border-left: 3px solid var(--pentair-blue);
  border-radius: var(--radius-card);
  padding: 12px 16px;
}

.setup-notes-card h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--pentair-blue);
  margin: 0 0 8px;
}

.setup-notes-card p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 4px 0;
}

/* Control */

.control-layout {
  max-width: 620px;
  display: grid;
  gap: 14px;
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
}

.control-layout .section {
  margin-top: 0;
}

.control-header {
  display: grid;
  gap: 8px;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.control-header.status-playing {
  border-color: rgba(34, 197, 94, 0.5);
  animation: controlPulseGreen 2.2s ease-in-out infinite;
}

.control-header.status-paused {
  border-color: rgba(245, 158, 11, 0.46);
  animation: controlPulseAmber 2.4s ease-in-out infinite;
}

@keyframes controlPulseGreen {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.09);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.03);
  }
}

@keyframes controlPulseAmber {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.07);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.025);
  }
}

.control-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-clock {
  font-size: 12px !important;
  text-align: right;
  color: var(--muted);
  flex-shrink: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control-script {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.play-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.play-button {
  width: 100%;
  min-height: 104px;
  font-size: 1.9rem;
  background: #22c55e;
  color: #fff;
}

.play-button.is-playing {
  background: #dc2626;
}

.play-button.is-paused {
  background: #22c55e;
}

.script-mirror-section {
  display: grid;
  gap: 12px;
}

.mirror-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mirror-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mirror-title {
  margin: 0;
}

.mini-action {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.88rem;
}

.script-mirror-shell {
  position: relative;
  min-height: 40vh;
  max-height: 42dvh;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 14px;
}

.script-mirror-text::before {
  content: '';
  display: block;
  height: 45%;
}

.script-mirror-text::after {
  content: '';
  display: block;
  height: 45%;
}

/* Mirror uses same tele- classes but scaled down — structure must match teleprompter exactly */
.script-mirror-text .tele-script-header {
  text-align: center;
  margin-bottom: 1em;
}

.script-mirror-text .tele-script-number {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.2em;
}

.script-mirror-text .tele-script-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 0.3em;
}

.script-mirror-text .tele-delivery-chip {
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 4px;
}

.script-mirror-text .tele-separator {
  width: 30%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 auto 0.8em auto;
}

.script-mirror-text .tele-paragraph {
  margin: 0 0 0.8em 0;
  font-size: inherit;
  line-height: 1.5;
}

.script-mirror-text .tele-empty {
  color: var(--muted);
  font-style: italic;
}

.script-mirror-shell.manual-synced {
  border-color: var(--success);
  transition: border-color 0.2s;
}

.script-mirror-text {
  position: relative;
  z-index: 1;
  padding: 18px 0;
  white-space: pre-wrap;
  font-size: 1.16rem;
  line-height: 1.6;
  color: #f5f5f5;
}

.mirror-viewport {
  position: relative;
}

.mirror-reading-zone {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 15%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  background: rgba(34, 197, 94, 0.12);
  border-left: 3px solid var(--success);
}

.script-editor-wrap {
  display: grid;
  gap: 10px;
}

.script-editor-wrap textarea {
  min-height: 260px;
  line-height: 1.5;
}

.editor-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.progress-section {
  display: grid;
  gap: 10px;
}

.progress-meta {
  display: flex;
  justify-content: flex-end;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
}

.scroll-progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  overflow: visible;
  touch-action: none;
}

.scroll-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e 0%, #ff3356 100%);
}

.scroll-progress-thumb {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--plexiz-red);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(255, 51, 86, 0.2);
}

.speed-cluster {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.speed-readout {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
}

.control-row-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.script-list-toggle {
  width: 100%;
}

.btn-active {
  background: var(--success) !important;
  color: white !important;
  border-color: var(--success) !important;
}

.control-reset-link {
  margin-top: 8px;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}

.control-force-hidden {
  display: none !important;
}

.script-list-wrapper {
  margin-top: 10px;
}

.script-list {
  display: grid;
  gap: 8px;
  max-height: 36dvh;
  overflow: auto;
}

.script-btn {
  min-height: var(--touch);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
  font-weight: 600;
}

.script-btn.active {
  border-color: var(--plexiz-red);
  background: rgba(255, 51, 86, 0.22);
}

/* Teleprompter */

body.teleprompter-page {
  background: #000;
  color: #fff;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

.teleprompter-shell {
  --tele-controls-height: 182px;
  position: relative;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.teleprompter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 56px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.teleprompter-screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-top: 22px;
  padding-right: max(20px, env(safe-area-inset-right));
  padding-bottom: calc(var(--tele-controls-height) + 28px);
  padding-left: max(20px, env(safe-area-inset-left));
  scroll-behavior: auto;
}

.teleprompter-text {
  max-width: 70%;
  margin: 0 auto;
  line-height: 1.6;
  font-size: var(--tele-font-size, 48px);
  font-weight: 500;
  letter-spacing: 0.01em;
  padding-top: 50vh;
  padding-bottom: 50vh;
}

/* Script header in teleprompter */
.tele-script-header {
  text-align: center;
  margin-bottom: 1.5em;
}

.tele-script-number {
  font-size: 0.4em;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.3em;
}

.tele-script-title {
  font-size: 0.6em;
  font-weight: 700;
  margin-bottom: 0.4em;
}

.tele-delivery-chip {
  display: inline-block;
  font-size: 0.35em;
  font-weight: 700;
  padding: 0.3em 0.8em;
  border-radius: 8px;
  letter-spacing: 1px;
}

.tele-mode-teleprompter {
  background: var(--pentair-blue);
  color: white;
}

.tele-mode-camera {
  background: var(--plexiz-red);
  color: white;
}

.tele-mode-voiceover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.tele-separator {
  width: 30%;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 auto 1.2em auto;
}

.tele-paragraph {
  margin: 0 0 1.2em 0;
  white-space: pre-wrap;
}

.tele-empty {
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}

/* Reading guide line */
.teleprompter-screen::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: rgba(34, 197, 94, 0.25);
  pointer-events: none;
  z-index: 5;
}

.teleprompter-text.mirrored {
  transform: scaleX(-1);
  transform-origin: center;
}

.teleprompter-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  min-height: var(--tele-controls-height);
  display: grid;
  grid-template-columns: 1.25fr repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px max(12px, env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(10, 10, 10, 0.84);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.tele-bar {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.tele-bar.controls-hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.tele-bar.remote-connected {
  display: none;
}

.teleprompter-shell.remote-connected .teleprompter-screen {
  padding-bottom: 28px;
}

.remote-indicator {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  right: max(12px, env(safe-area-inset-right));
  z-index: 25;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0.7;
}

.teleprompter-controls .group {
  display: grid;
  gap: 5px;
}

.teleprompter-controls .group label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.75);
}

.teleprompter-play {
  min-height: 56px;
  font-size: 1.15rem;
  background: var(--success);
}

.teleprompter-play.is-playing {
  background: var(--danger);
}

.teleprompter-controls input[type='range'] {
  width: 100%;
  min-height: 34px;
  accent-color: var(--plexiz-red);
}

.teleprompter-controls select,
.teleprompter-controls .btn {
  min-height: 46px;
}

.mirror-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
}

.mirror-row input[type='checkbox'] {
  width: 20px;
  height: 20px;
  accent-color: var(--plexiz-red);
}

.teleprompter-empty {
  max-width: 820px;
  margin: 24px auto;
  text-align: center;
  color: rgba(255, 255, 255, 0.82);
}

@media (min-width: 1024px) and (orientation: landscape) {
  .teleprompter-shell {
    --tele-controls-height: 174px;
  }

  .teleprompter-header {
    padding: 10px 20px;
  }

  .teleprompter-screen {
    padding-top: 28px;
  }

  .teleprompter-controls {
    grid-template-columns: 1.45fr 1fr 1fr 1.2fr 0.9fr;
    gap: 12px;
  }

  .teleprompter-play {
    min-height: 60px;
    font-size: 1.22rem;
  }
}

@media (min-width: 1024px) {
  .brand-logo {
    height: 24px;
  }

  .brand-logo.pentair {
    height: 26px;
  }
}

@media (max-width: 920px) {
  .teleprompter-shell {
    --tele-controls-height: 248px;
  }

  .teleprompter-screen {
    padding: 18px 20px calc(var(--tele-controls-height) + 24px);
  }

  .teleprompter-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .shoot-clock {
    top: calc(env(safe-area-inset-top) + 92px);
  }

  .topbar-meta {
    text-align: left;
  }

  .page {
    padding: var(--space-2);
  }

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

  .play-button {
    min-height: 88px;
    font-size: 1.6rem;
  }

  .script-mirror-shell {
    min-height: 220px;
  }

  .progress-counter {
    top: calc(env(safe-area-inset-top) + 126px);
  }

  .director-quality-actions {
    grid-template-columns: 1fr;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
  }

}

/* Prevent accidental zoom on mobile (except teleprompter) */
/* touch-action: manipulation prevents double-tap zoom */
/* touch-action: pan-y on inputs prevents pinch zoom while allowing scroll */
html {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

.control-layout,
.index-main,
.director-layout,
.talento-layout,
.equipo-layout {
  touch-action: manipulation;
}

/* Prevent iOS Safari zoom on input focus (font-size >= 16px) */
input, select, textarea, button {
  font-size: 16px !important;
}

/* Block pinch-to-zoom via gesture events */
.page-shell {
  touch-action: pan-x pan-y;
  -webkit-touch-callout: none;
}
