:root {
  color-scheme: dark;
  --ink: #090908;
  --ink-soft: #11110f;
  --surface: #171714;
  --surface-raised: #20201c;
  --surface-hover: #292822;
  --line: rgba(241, 238, 231, 0.12);
  --line-strong: rgba(241, 238, 231, 0.22);
  --paper: #f1eee7;
  --paper-soft: #d9d4ca;
  --muted: #918d84;
  --sand: #c9bca8;
  --bronze: #af8c60;
  --bronze-bright: #d1ad7b;
  --success: #47c878;
  --warning: #e8b454;
  --danger: #ee6459;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
  --ui-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --tp-font: Arial, Helvetica, ui-sans-serif, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--bronze-bright);
  outline-offset: 2px;
}

.eyebrow {
  color: var(--bronze-bright);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 15px;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}

.button:active,
.icon-button:active,
.play-button:active {
  transform: translateY(1px);
}

.button-primary {
  border-color: var(--bronze);
  background: var(--bronze);
  color: #100d09;
}

.button-primary:hover {
  border-color: var(--bronze-bright);
  background: var(--bronze-bright);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--paper-soft);
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--paper);
}

.button-accent {
  border-color: rgba(209, 173, 123, 0.65);
  background: rgba(175, 140, 96, 0.17);
  color: var(--bronze-bright);
}

.button-accent:hover {
  background: rgba(175, 140, 96, 0.26);
}

.button-ghost {
  border-color: var(--line);
  color: var(--paper-soft);
}

.button-block {
  width: 100%;
}

.button-large {
  min-height: 54px;
  border-radius: 13px;
  padding-inline: 22px;
  font-size: 15px;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--paper);
  font-size: 15px;
  font-weight: 800;
}

.icon-button:hover {
  background: var(--surface-hover);
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #0d0d0b;
  color: var(--paper);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field input {
  height: 43px;
  padding: 0 12px;
}

.field textarea {
  min-height: 240px;
  padding: 13px;
  resize: none;
  font-family: var(--tp-font);
  font-size: 14px;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(209, 173, 123, 0.72);
  box-shadow: 0 0 0 3px rgba(175, 140, 96, 0.13);
}

/* Painel do operador */

.operator-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 45% -20%, rgba(175, 140, 96, 0.11), transparent 34%),
    var(--ink);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  height: 68px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  background: rgba(9, 9, 8, 0.96);
}

.brand,
.join-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--bronze);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 800;
}

.brand strong,
.join-brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  letter-spacing: 0.14em;
}

.brand small,
.join-brand small {
  display: block;
  margin-top: 1px;
  color: var(--bronze-bright);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.connection-dot,
.display-connection > span {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(232, 180, 84, 0.1);
}

.connection-dot[data-mode="online"] {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(71, 200, 120, 0.1);
}

.connection-dot[data-mode="offline"] {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(238, 100, 89, 0.1);
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.operator-shell {
  display: grid;
  height: calc(100vh - 148px);
  min-height: 540px;
  grid-template-columns: minmax(235px, 0.76fr) minmax(480px, 2.15fr) minmax(270px, 0.88fr);
  gap: 12px;
  padding: 12px;
}

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(18, 18, 16, 0.92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.script-panel,
.devices-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-hover) transparent;
}

.script-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  background: #0d0d0b;
}

.script-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.script-tabs button.is-active {
  background: var(--surface-raised);
  color: var(--paper);
}

.script-pane {
  min-height: 0;
}

.editor-pane {
  display: flex;
  min-height: 480px;
  flex: 1;
  flex-direction: column;
  gap: 15px;
}

.script-primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.library-pane {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 13px;
}

.library-heading {
  display: grid;
  gap: 10px;
}

.library-heading strong {
  font-size: 13px;
}

.library-heading p,
.library-empty p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.script-library-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.library-card,
.library-empty {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: #11110f;
}

.library-card strong,
.library-empty strong {
  display: block;
  font-size: 11px;
}

.library-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.library-card > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-family: var(--tp-font);
  font-size: 10px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.library-card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.panel-heading,
.live-heading,
.dialog-heading,
.display-controls-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-heading h1,
.panel-heading h2,
.live-heading h2,
.dialog-heading h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.save-status {
  color: var(--success);
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.save-status.is-dirty {
  color: var(--warning);
}

.field-grow {
  min-height: 255px;
  flex: 1;
}

.field-grow textarea {
  height: 100%;
}

.script-meta {
  display: flex;
  justify-content: space-between;
  margin-top: -7px;
  color: var(--muted);
  font-size: 11px;
}

.markers {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}

.subheading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--paper-soft);
  font-size: 12px;
  font-weight: 750;
}

.subheading small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.marker-list {
  display: grid;
  gap: 5px;
}

.marker-button {
  display: grid;
  min-height: 38px;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 8px;
  padding: 6px 8px;
  background: transparent;
  color: var(--paper-soft);
  text-align: left;
}

.marker-button:hover {
  background: var(--surface-raised);
}

.marker-button strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-button small {
  color: var(--muted);
  font-size: 9px;
}

.marker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bronze);
}

.live-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(300px, 1fr) auto auto;
  gap: 14px;
  padding: 18px;
}

.live-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.edit-script-button {
  min-height: 31px;
  border-color: rgba(209, 173, 123, 0.38);
  padding-inline: 12px;
  color: var(--bronze-bright);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.live-panel.is-editing {
  grid-template-rows: auto minmax(0, 1fr);
}

.live-panel.is-editing > .operator-preview,
.live-panel.is-editing > .timeline,
.live-panel.is-editing > .quick-actions {
  display: none;
}

.large-script-editor {
  display: grid;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(209, 173, 123, 0.28);
  border-radius: var(--radius-md);
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(175, 140, 96, 0.06), transparent 34%),
    #0b0b0a;
  box-shadow: inset 0 0 70px rgba(175, 140, 96, 0.025);
}

.large-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.large-editor-heading h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.large-editor-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.large-script-field {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.large-script-field textarea {
  height: 100%;
  min-height: 280px;
  padding: 20px 22px;
  caret-color: var(--bronze-bright);
  font-size: clamp(17px, 1.25vw, 22px);
  line-height: 1.62;
  resize: none;
  scrollbar-color: var(--surface-hover) transparent;
  scrollbar-width: thin;
}

.large-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.large-editor-status {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.large-editor-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 9px;
}

.live-badges {
  display: flex;
  gap: 7px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 9px;
  background: var(--surface-raised);
  color: var(--warning);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.status-badge[data-playing="true"] {
  border-color: rgba(71, 200, 120, 0.35);
  background: rgba(71, 200, 120, 0.1);
  color: var(--success);
}

.status-badge-muted {
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Renderizador compartilhado */

.tp-viewport {
  --tp-font-scale: 1;
  --tp-column-width: 88%;
  --tp-line-height: 1.28;
  --tp-brightness: 1;
  --tp-cue-position: 42%;
  --tp-band-height: 1.55;
  --tp-band-opacity: 0.1;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #000;
}

.tp-safe-column,
.tp-mirror {
  position: absolute;
  inset: 0;
}

.tp-mirror {
  transform-origin: center;
  filter: brightness(var(--tp-brightness));
  will-change: transform;
}

.tp-content {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  width: min(21em, var(--tp-column-width));
  margin-inline: auto;
  color: #fff;
  font-family: var(--tp-font);
  font-size: calc(clamp(27px, 3.1vw, 50px) * var(--tp-font-scale));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--tp-line-height);
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.tp-reading-band {
  position: absolute;
  z-index: 2;
  top: var(--tp-cue-position);
  right: 0;
  left: 0;
  height: calc(1em * var(--tp-band-height));
  border-top: 1px solid rgba(209, 173, 123, calc(var(--tp-band-opacity) * 1.35));
  border-bottom: 1px solid rgba(209, 173, 123, calc(var(--tp-band-opacity) * 1.35));
  background: rgba(175, 140, 96, var(--tp-band-opacity));
  pointer-events: none;
  transform: translateY(-50%);
}

.tp-word {
  border-radius: 0.15em;
  transition: color 100ms linear, background 100ms linear;
}

.operator-preview .tp-word {
  cursor: pointer;
}

.operator-preview .tp-word:hover {
  background: rgba(175, 140, 96, 0.16);
}

.tp-word.is-current {
  background: var(--bronze);
  color: #090908;
}

.tp-cue {
  position: absolute;
  z-index: 3;
  top: var(--tp-cue-position);
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: none;
  transform: translateY(-50%);
}

.tp-cue::before,
.tp-cue::after {
  width: 12px;
  height: 1px;
  background: rgba(209, 173, 123, 0.8);
  content: "";
}

.tp-cue span {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(209, 173, 123, 0.16), rgba(209, 173, 123, 0.6), rgba(209, 173, 123, 0.16));
}

.tp-cue small {
  position: absolute;
  right: 18px;
  bottom: 7px;
  color: rgba(209, 173, 123, 0.7);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.operator-preview {
  min-height: 300px;
  border: 1px solid rgba(209, 173, 123, 0.22);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 80px rgba(175, 140, 96, 0.03);
}

.operator-preview::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(#000 0%, transparent 15%, transparent 84%, #000 100%);
  content: "";
}

.preview-corner {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 13px;
  border-radius: 6px;
  padding: 5px 7px;
  background: rgba(9, 9, 8, 0.72);
  color: rgba(241, 238, 231, 0.5);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.timeline {
  display: grid;
  gap: 6px;
}

.timeline input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--bronze-bright);
  cursor: ew-resize;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

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

.quick-actions .button {
  min-width: 0;
  padding-inline: 10px;
}

.readiness {
  display: grid;
  min-width: 45px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--warning);
  font-size: 11px;
  font-weight: 850;
}

.readiness[data-ready="true"] {
  border-color: rgba(71, 200, 120, 0.4);
  background: rgba(71, 200, 120, 0.1);
  color: var(--success);
}

.join-card {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(175, 140, 96, 0.3);
  border-radius: 13px;
  padding: 15px;
  background: linear-gradient(145deg, rgba(175, 140, 96, 0.12), rgba(175, 140, 96, 0.035));
}

.qr-code {
  display: grid;
  width: min(100%, 210px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 8px solid #fff;
  border-radius: 12px;
  background: #fff;
  color: #000;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-code[data-loading="true"]::after {
  color: #333;
  content: "Gerando QR…";
  font-size: 10px;
  letter-spacing: 0;
}

.join-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.room-code {
  color: var(--paper);
  font-size: clamp(26px, 2.2vw, 35px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.13em;
  line-height: 1;
  white-space: nowrap;
}

.join-card p,
.operator-note p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.display-url {
  overflow: hidden;
  color: var(--bronze-bright);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.copy-feedback {
  min-height: 13px;
  color: var(--success);
  font-size: 9px;
}

.device-summary {
  color: var(--muted);
  font-size: 10px;
}

.device-list {
  display: grid;
  gap: 8px;
}

.device-card,
.device-placeholder {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px;
  background: #11110f;
}

.device-card[data-active="false"] {
  opacity: 0.55;
}

.device-card-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.device-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--success);
}

.device-card[data-active="false"] .device-status-dot {
  background: var(--muted);
}

.device-card-heading strong,
.device-placeholder strong {
  display: block;
  font-size: 11px;
}

.device-card-heading small,
.device-placeholder small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.device-card-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.device-calibration {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.device-range {
  display: grid;
  gap: 4px;
}

.device-range > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.device-range small {
  color: var(--muted);
  font-size: 8px;
}

.device-range strong {
  color: var(--paper-soft);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.device-range input {
  width: 100%;
  height: 12px;
  margin: 0;
  accent-color: var(--bronze-bright);
}

.device-action {
  display: grid;
  min-width: 0;
  min-height: 42px;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.device-action:hover,
.device-action.is-active {
  border-color: rgba(209, 173, 123, 0.5);
  background: rgba(175, 140, 96, 0.15);
  color: var(--bronze-bright);
}

.device-action span {
  font-size: 14px;
  font-weight: 800;
}

.device-action small {
  overflow: hidden;
  max-width: 100%;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-placeholder {
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 9px;
  color: var(--muted);
}

.device-placeholder > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  font-size: 10px;
}

.operator-note {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.operator-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--paper-soft);
  font-size: 10px;
}

.transport {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: 80px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 0 24px;
  background: rgba(11, 11, 10, 0.98);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.22);
}

.transport-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.line-button,
.voice-button {
  display: flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-raised);
  color: var(--paper);
}

.line-button {
  min-width: 66px;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
}

.line-button > span {
  font-size: 17px;
  font-weight: 850;
}

.line-button > small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.voice-button {
  gap: 9px;
  padding: 0 12px;
}

.voice-button > span:last-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.voice-button strong {
  font-size: 9px;
  letter-spacing: 0.08em;
}

.voice-button small {
  max-width: 130px;
  overflow: hidden;
  color: var(--muted);
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--muted);
}

.voice-button[data-mode="listening"],
.voice-button[data-mode="tracking"],
.voice-button[data-mode="device"] {
  border-color: rgba(71, 200, 120, 0.45);
  background: rgba(71, 200, 120, 0.1);
}

.voice-button[data-mode="listening"] .voice-dot,
.voice-button[data-mode="tracking"] .voice-dot,
.voice-button[data-mode="device"] .voice-dot {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(71, 200, 120, 0.1);
  animation: voice-pulse 1.6s infinite;
}

.voice-button[data-mode="error"] {
  border-color: rgba(238, 100, 89, 0.45);
}

@keyframes voice-pulse {
  50% {
    box-shadow: 0 0 0 9px rgba(71, 200, 120, 0);
  }
}

.transport-speed {
  justify-content: flex-end;
}

.play-button {
  display: flex;
  min-width: 188px;
  height: 54px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid var(--bronze-bright);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  box-shadow: 0 7px 24px rgba(0, 0, 0, 0.24);
}

.play-icon {
  min-width: 18px;
  font-size: 17px;
}

.speed-control {
  display: grid;
  min-width: 178px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 3px;
}

.speed-control > span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.speed-control strong {
  display: flex;
  align-items: baseline;
  color: var(--paper);
}

.speed-control input {
  width: 43px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font-weight: 800;
  text-align: right;
  appearance: textfield;
}

.speed-control input::-webkit-inner-spin-button {
  appearance: none;
}

.speed-control small {
  color: var(--muted);
  font-size: 9px;
}

.speed-range {
  width: 100%;
  height: 12px;
  grid-column: 1 / -1;
  margin: 0;
  accent-color: var(--bronze-bright);
  cursor: ew-resize;
}

.shortcuts-dialog {
  width: min(480px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  background: var(--surface);
  color: var(--paper);
  box-shadow: var(--shadow);
}

.shortcuts-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.shortcuts-dialog form {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.shortcut-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.shortcut-list > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.shortcut-list dt {
  font-size: 12px;
  font-weight: 750;
}

.shortcut-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 96px;
  left: 50%;
  max-width: min(520px, calc(100vw - 30px));
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 17px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Tela iPhone/iPad */

.display-page {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.display-app,
.display-stage,
.display-prompter {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
}

.display-join {
  min-height: 100dvh;
  overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 0, rgba(175, 140, 96, 0.18), transparent 38%),
    var(--ink);
}

.join-brand {
  margin-bottom: clamp(45px, 9vh, 90px);
}

.join-content {
  width: min(460px, 100%);
  margin: 0 auto;
}

.join-content h1 {
  max-width: 420px;
  margin: 10px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 7vw, 49px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.04;
}

.join-content > p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.join-content form {
  display: grid;
  gap: 15px;
}

.join-code-input {
  height: 64px !important;
  font-size: 27px !important;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.join-help {
  margin-top: 18px !important;
  font-size: 11px !important;
  text-align: center;
}

.join-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.display-stage {
  position: relative;
  overflow: hidden;
  background: #000;
}

.display-prompter .tp-content {
  width: min(22em, var(--tp-column-width));
  padding-inline: 1vw;
  font-size: calc(clamp(38px, 7.2vh, 82px) * var(--tp-font-scale));
  line-height: var(--tp-line-height);
}

.display-prompter::before,
.display-prompter::after {
  position: absolute;
  z-index: 2;
  right: 0;
  left: 0;
  height: 12vh;
  pointer-events: none;
  content: "";
}

.display-prompter::before {
  top: 0;
  background: linear-gradient(#000, transparent);
}

.display-prompter::after {
  bottom: 0;
  background: linear-gradient(transparent, #000);
}

.tp-cue-display {
  opacity: 0.55;
}

.tp-cue-display::before,
.tp-cue-display::after {
  width: max(8px, env(safe-area-inset-left));
}

.display-connection {
  position: absolute;
  z-index: 6;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(0, 0, 0, 0.68);
  color: rgba(255, 255, 255, 0.68);
  font-size: 9px;
  backdrop-filter: blur(8px);
}

.display-connection > span {
  width: 6px;
  height: 6px;
  flex-basis: 6px;
  background: var(--success);
  box-shadow: none;
}

.display-connection[data-mode="reconnecting"] > span {
  background: var(--warning);
}

.display-connection[data-mode="offline"] > span {
  background: var(--danger);
}

.activation-sheet,
.voice-activation-sheet,
.display-controls {
  position: absolute;
  z-index: 20;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  width: min(480px, calc(100% - 32px));
  margin: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 22px;
  background: rgba(23, 23, 20, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.voice-activation-sheet {
  position: absolute;
  z-index: 24;
  top: 50%;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  transform: translateY(-50%);
}

.voice-activation-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(71, 200, 120, 0.45);
  border-radius: 50%;
  background: rgba(71, 200, 120, 0.1);
  color: var(--success);
  font-size: 20px;
}

.voice-activation-sheet h2 {
  margin: 6px 0;
  font-size: 21px;
}

.voice-activation-sheet p {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.voice-activation-sheet small {
  display: block;
  min-height: 14px;
  margin-top: 9px;
  color: var(--warning);
  font-size: 9px;
}

.activation-sheet h2 {
  margin: 7px 0 8px;
  font-size: 24px;
}

.activation-sheet p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.activation-sheet .button {
  width: 100%;
}

.display-controls {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.display-controls-heading strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
}

.display-control-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.display-setting {
  display: grid;
  min-height: 68px;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--paper-soft);
}

.display-setting.is-active {
  border-color: var(--bronze-bright);
  background: rgba(175, 140, 96, 0.19);
  color: var(--bronze-bright);
}

.display-setting > span {
  font-size: 19px;
  font-weight: 850;
}

.display-setting strong {
  font-size: 9px;
}

.display-controls > p {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.unlock-corner {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: 0;
  width: max(58px, calc(env(safe-area-inset-right) + 46px));
  height: max(58px, calc(env(safe-area-inset-bottom) + 46px));
  border: 0;
  background: transparent;
  opacity: 0;
}

.identify-card {
  position: absolute;
  z-index: 25;
  top: 50%;
  left: 50%;
  min-width: min(430px, 80vw);
  border: 2px solid var(--bronze-bright);
  border-radius: 20px;
  padding: 24px;
  background: rgba(9, 9, 8, 0.96);
  color: var(--paper);
  text-align: center;
  box-shadow: 0 20px 80px #000;
  transform: translate(-50%, -50%);
}

.identify-card span {
  display: block;
  color: var(--bronze-bright);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.identify-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(32px, 7vw, 68px);
  text-transform: uppercase;
}

.display-stage.is-locked {
  touch-action: none;
}

@media (max-width: 1180px) {
  .operator-shell {
    grid-template-columns: minmax(220px, 0.75fr) minmax(460px, 1.8fr);
  }

  .devices-panel {
    position: fixed;
    z-index: 25;
    top: 80px;
    right: 12px;
    bottom: 92px;
    width: 290px;
    transform: translateX(calc(100% + 20px));
  }

  .operator-page.show-devices .devices-panel {
    transform: translateX(0);
  }
}

@media (max-width: 820px) {
  .operator-page {
    overflow: auto;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 14px;
  }

  .topbar-center {
    display: none;
  }

  .operator-shell {
    height: auto;
    min-height: calc(100vh - 68px);
    grid-template-columns: 1fr;
    padding-bottom: 96px;
  }

  .live-panel {
    min-height: 680px;
    order: -1;
  }

  .script-panel {
    min-height: 620px;
  }

  .devices-panel {
    position: static;
    width: auto;
    min-height: 500px;
    transform: none;
  }

  .transport {
    padding-inline: 10px;
  }

  .transport-jog .icon-button:nth-child(2),
  .transport-speed .icon-button:last-child {
    display: none;
  }

  .play-button {
    min-width: 150px;
  }
}

@media (max-width: 620px) {
  .topbar-actions .button:first-child,
  .transport-jog {
    display: none;
  }

  .transport {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .transport-speed {
    justify-content: space-between;
  }

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

  .live-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .live-heading-actions {
    justify-content: space-between;
  }

  .large-script-editor {
    padding: 14px;
  }

  .large-editor-heading {
    flex-direction: column;
    gap: 8px;
  }

  .large-script-field textarea {
    padding: 15px;
    font-size: 17px;
  }

  .large-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .large-editor-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .live-panel {
    min-height: 760px;
  }

  .display-control-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (orientation: portrait) {
  .display-stage.force-landscape .display-prompter {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100dvh;
    height: 100vw;
    min-height: 0;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center;
  }

  .display-stage.force-landscape .display-prompter .tp-content {
    width: min(22em, var(--tp-column-width));
    font-size: calc(clamp(36px, 17vw, 72px) * var(--tp-font-scale));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
