/* Base variables and reset */
:root {
  --bg-start: 20, 20, 30;
  --bg-end: 40, 40, 60;
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.14);
  --text: #e5e7eb;
  --muted: #cbd5e1;
  --accent: #3b82f6;
  --warn: #d97706;
  --surface: #0f172a;
  --surface-2: #1f2937;
  --yellow: #facc15;
}

/* GSC Mobile Usability: 48px targets */
button,
.btn,
select,
input,
textarea {
  min-height: 48px;
  min-width: 48px;
}

/* Visually hidden (for accessible labels) */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font: 500 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  /* Fallback */
  background: url('bg.jpg') center / cover no-repeat fixed, linear-gradient(135deg, rgb(var(--bg-start)), rgb(var(--bg-end)));
  /* Prefer optimized formats when supported */
  background: image-set(url('bg.avif') type("image/avif"),
      url('bg.webp') type("image/webp"),
      url('bg.jpg') type("image/jpeg")) center / cover no-repeat fixed,
    linear-gradient(135deg, rgb(var(--bg-start)), rgb(var(--bg-end)));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  /* Main app is fixed */
}

/* Layout adjustments for standalone content/SEO pages rendered outside the main app grid */
body.content-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
}

body.content-page #main {
  flex: 1;
  min-height: 0;
  width: min(960px, calc(100% - 48px));
  margin: 0;
  padding: 24px 24px 80px;
  box-sizing: border-box;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

body.content-page footer.meta-bar {
  width: min(960px, calc(100% - 48px));
  margin: 16px 0 0;
}

.content-top-bar {
  width: min(960px, calc(100% - 48px));
  margin: 24px 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.content-top-bar .btn {
  padding: 7px 18px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.content-top-bar .meta-left,
.content-top-bar .meta-right {
  color: #e5e7eb;
}

a,
a:visited {
  color: #fff;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
  transition: color .2s ease, text-shadow .2s ease;
}

a:hover,
a:focus-visible {
  color: #bae6fd;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.95);
}

a:active {
  color: #e0f2fe;
  text-shadow: 0 0 6px rgba(255, 255, 255, 1);
}

/* Background elements */
#background-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#background-overlay {
  background: linear-gradient(135deg, rgba(20, 20, 30, 0.8), rgba(40, 40, 60, 0.8));
}

.landing-section {
  position: relative;
  z-index: 1;
  margin: 12px 12px 0;
  padding: 18px 24px;
  display: flex;
}

.landing-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.landing-grid article {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  gap: 12px;
  content-visibility: auto;
  contain-intrinsic-size: 200px;
}

.landing-grid h2 {
  margin: 0;
  font-size: 18px;
}

.landing-grid ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.landing-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.landing-cta .btn {
  flex: 0 0 auto;
}

/* Editor & Control Adjustments */
/* Landing styles removed */

/* Modal Overlay & Content */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: min(800px, 90vw);
  /* Nearly full width/large */
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: relative;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-content>[data-show] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 24px;
  padding-right: 32px;
}

.modal-content .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.modal-content .close-btn:hover {
  color: var(--text);
}

.scrollable-text {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 8px;
  font-size: 15px;
  line-height: 1.6;
}


.separator {
  border: 0;
  border-top: 1px solid var(--glass-border);
  margin: 8px 0;
}

/* Scrollbar for modal text */
.scrollable-text::-webkit-scrollbar {
  width: 6px;
}

.scrollable-text::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.policy-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

.policy-table th,
.policy-table td {
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 10px;
  vertical-align: top;
  background: rgba(15, 23, 42, 0.4);
}

.policy-table th {
  background: rgba(59, 130, 246, 0.18);
  text-align: left;
  font-weight: 600;
}

.policy-table a {
  color: var(--accent);
}

.help-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.creator-spotlight {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.creator-spotlight h3 {
  margin: 0;
  font-size: 17px;
}

.creator-spotlight:last-of-type {
  margin-bottom: 0;
}

/* Ads default-off switch: keep placeholders hidden unless ads are enabled */
body.ads-off #ad-panel-mobile,
body.ads-off .ad-unit {
  display: none !important;
}

.ad-unit {
  margin: 12px auto 0;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}

.ad-unit .ad-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #e5e7eb;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.ad-unit .ad-close:hover,
.ad-unit .ad-close:focus-visible {
  background: rgba(59, 130, 246, 0.85);
  color: #fff;
}

#script-editor-panel .ad-unit {
  align-self: center;
  width: min(320px, 100%);
}


.ad-unit ins {
  width: 100%;
  min-height: 90px;
  max-width: 100%;
  max-height: 280px;
  display: block;
}

.ad-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Layout */
#main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  flex: 1;
  overflow: hidden;
  width: 100%;
}

#ad-panel-mobile {
  display: none;
}

@media (min-width: 900px) {
  #main {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: stretch;
  }
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

/* Editor panel */
#script-editor-panel {
  display: flex;
  flex-direction: column;
  padding: 14px;
  min-height: 0;
}

#script-editor-panel .panel-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

#script-editor-panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

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

.small {
  font-size: 12px;
}

#script-editor-panel textarea {
  width: 100%;
  flex: 1;
  min-height: 160px;
  resize: none;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px;
  outline: none;
  transition: border-color .2s ease;
}

#script-editor-panel textarea:focus {
  border-color: var(--accent);
}

/* Teleprompter */
#teleprompter-container {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.teleprompter-display {
  flex: 1;
  overflow-y: auto;
  padding: 24px 4vw;
  text-align: center;
  scroll-behavior: smooth;
}

.teleprompter-display::-webkit-scrollbar {
  width: 8px;
}

.teleprompter-display::-webkit-scrollbar-track {
  background: #2d3748;
}

.teleprompter-display::-webkit-scrollbar-thumb {
  background: #4a5568;
  border-radius: 4px;
}

.teleprompter-display::-webkit-scrollbar-thumb:hover {
  background: #718096;
}

.marker {
  position: absolute;
  left: 0;
  top: 40%;
  width: 100%;
  transform: translateY(-50%);
  pointer-events: none;
}

.marker-line {
  height: 3px;
  background: linear-gradient(to right, rgba(250, 204, 21, 0), rgba(250, 204, 21, 1), rgba(250, 204, 21, 0));
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.7);
}

.spoken-word {
  color: var(--yellow);
  transition: color .25s ease-in-out;
}

.spoken-word.current-word {
  background: rgba(250, 204, 21, .25);
  border-radius: 4px;
}

.manual-controls {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn,
.icon-btn {
  user-select: none;
  -webkit-user-select: none;
}

.icon-btn:hover {
  outline: 2px solid rgba(255, 255, 255, 0.08);
}

/* Desktop recordings floating button (relative to teleprompter container) */
.fab {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.fab:hover {
  outline: 2px solid rgba(255, 255, 255, 0.08);
}

.fab.recordings {
  border-color: rgba(220, 38, 38, .35);
}

.fab.recordings::before {
  content: '⏺';
}

/* keep absolute positioning relative to teleprompter container */
.fab .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .4);
}

/* Tooltip via data-tip attribute */
.fab[data-tip] {
  position: relative;
}

.fab[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  top: 110%;
  right: 0;
  background: rgba(15, 23, 42, .95);
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}

.desktop-only {
  display: none;
}

@media (min-width: 900px) {
  .desktop-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Enforce desktop-only visibility rules after generic .control rules */
@media (max-width: 899px) {
  .desktop-only {
    display: none !important;
  }
}

@media (min-width: 900px) {
  .desktop-only {
    display: inline-flex !important;
  }
}

/* Mobile layout: show editor by default; teleprompter only when recording */
@media (max-width: 899px) {
  #teleprompter-container {
    display: none;
  }

  body.is-recording #teleprompter-container {
    display: flex;
  }

  #main,
  #controls,
  #ad-panel-mobile,
  .meta-bar {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  #main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    overflow-y: auto;
    background: transparent;
  }

  /* Internal panel spacing */
  #script-editor-panel,
  .landing-hero {
    padding: 12px;
    width: 100%;
    flex-shrink: 0;
  }

  .meta-bar {
    padding: 12px 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border) !important;
  }

  #controls {
    padding: 8px 12px;
    border-top: 1px solid var(--glass-border) !important;
  }

  /* Mobile: when recordings open, replace script panel */
  #recordings-sidebar {
    display: none;
  }

  #recordings-sidebar.open {
    display: flex;
  }

  body.mobile-recordings #script-editor-panel {
    display: none;
  }

  body.mobile-recordings #recordings-sidebar {
    display: flex;
  }

  /* Mobile: privacy view replaces script panel */
  .privacy-panel {
    display: none;
  }

  .privacy-panel.open {
    display: flex;
  }

  body.mobile-privacy #script-editor-panel {
    display: none;
  }

  body.mobile-privacy .privacy-panel {
    display: flex;
  }

  /* Mobile: tighten editor spacing */
  #script-editor-panel {
    padding: 6px;
  }

  #script-editor-panel .panel-inner {
    gap: 4px;
  }

  #script-editor-panel h2 {
    margin: 0 0 4px;
  }

  #script-editor-panel .panel-inner p.muted {
    margin: 2px 0 6px;
  }

  /* Mobile: show bottom ad panel wrapper, keep hidden by default via body.ads-off */
  #ad-panel-mobile {
    margin: 0 8px 8px;
    display: flex;
    justify-content: center;
  }

  #ad-panel-mobile .ad-unit {
    width: min(320px, 100%);
    margin: 0;
  }

  /* Compact settings */
  #controls {
    padding: 6px;
  }

  .controls-row {
    gap: 6px;
  }

  .control {
    gap: 6px;
    padding: 4px 6px;
    background: transparent;
    border: 0;
  }

  .control input[type="number"] {
    width: 56px;
  }

  .control input[type="range"],
  .control select,
  .control input[type="number"] {
    padding: 4px 6px;
    font-size: 14px;
  }

  .btn {
    padding: 6px 10px;
    font-size: 14px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
  }

  #script-editor-panel .ad-unit {
    display: none;
  }

  body.content-page #main {
    width: 100%;
    margin: 0;
    padding: 12px 12px 24px;
    border: 0;
    border-radius: 0;
  }

  body.content-page footer.meta-bar {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .content-top-bar {
    width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .content-top-bar .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Video preview */
#video-preview-container {
  position: absolute;
  bottom: 120px;
  left: 10px;
  width: 160px;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, .4);
  z-index: 70;
}

@media (max-width: 899px) {
  #video-preview-container {
    width: 120px;
    bottom: 80px;
    left: 8px;
  }
}

#video-preview-container:hover {
  border-color: var(--accent);
}

#video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(1);
  cursor: move;
}

/* Idle placeholder overlay inside PIP */
.pip-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .35);
  color: #e5e7eb;
  font-size: 38px;
  pointer-events: none;
}

/* Recordings sidebar as in-flow panel */
#recordings-sidebar {
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  min-width: 280px;
  max-height: 100%;
  overflow: hidden;
}

#recordings-sidebar.open {
  display: flex;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.close-btn {
  background: transparent;
  color: var(--text);
  border: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.recordings-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recordings-list li {
  background: var(--surface-2);
  border: 1px solid #374151;
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recordings-list .recording-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recordings-list .recording-name {
  font-weight: 600;
}

.recordings-list .recording-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recordings-list .recording-player {
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #000;
}

.recordings-list a {
  text-decoration: none;
  color: white;
  background: var(--accent);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

/* Badge on buttons */
.btn.has-badge {
  position: relative;
}

.btn .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .4);
}

/* Mic level meter */
.mic-level {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(31, 41, 55, .35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

.mic-level .mic-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, .6);
}

.mic-level .mic-bar {
  position: relative;
  width: 120px;
  height: 8px;
  background: rgba(255, 255, 255, .08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
}

.mic-level .mic-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #f59e0b);
  border-radius: 999px;
  transition: width .08s linear;
}

@media (max-width: 899px) {
  #mic-control {
    display: none;
  }

  .mic-level .mic-bar {
    width: 90px;
  }

  #reload-devices-btn {
    display: none;
  }
}

/* Footer controls */
#controls {
  position: relative;
  z-index: 0;
  margin: 0 12px 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.controls-row.wrap {
  flex-wrap: wrap;
  gap: 12px;
}

.control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: rgba(31, 41, 55, .35);
}

.control#mic-control,
#mic-control {
  max-width: 300px;
}

#mic-select {
  max-width: 100px;
}

.control input[type="number"] {
  width: 64px;
  text-align: center;
}

.control input[type="range"],
.control select,
.control input[type="number"] {
  background: rgba(31, 41, 55, .7);
  color: var(--text);
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 6px 8px;
}

.control.toggle {
  gap: 12px;
}

.toggle-switch {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.toggle-switch .track {
  position: relative;
  width: 46px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  display: inline-block;
  vertical-align: middle;
  transition: background .2s ease;
}

.toggle-switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e5e7eb;
  transition: transform .2s ease;
}

.toggle-switch[aria-pressed="true"] .track {
  background: #22c55e;
  border-color: rgba(255, 255, 255, 0.35);
}

.toggle-switch[aria-pressed="true"] .thumb {
  transform: translateX(22px);
}

.link,
.link:visited {
  color: #fff;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
  text-decoration: underline;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.link:hover,
.link:focus-visible {
  color: #bae6fd;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.95);
}

.version {
  position: absolute;
  left: 10px;
  bottom: 8px;
  color: #6b7280;
  font-size: 12px;
}

.legal {
  position: absolute;
  right: 10px;
  bottom: 8px;
}

.legal a {
  color: #fff;
}

/* Meta bar */
.meta-bar {
  margin: 0 12px 12px;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

@media (max-width: 600px) {
  .meta-bar {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2px;
    margin: 0;
    padding: 6px 8px;
  }
}

.meta-left {
  justify-self: start;
  color: #9ca3af;
}

.meta-center {
  justify-self: center;
}

.meta-right {
  justify-self: end;
  text-align: right;
  color: #9ca3af;
}

@media (max-width: 600px) {

  .meta-left,
  .meta-center,
  .meta-right {
    justify-self: center;
    text-align: center;
  }
}

.meta-bar a {
  color: inherit;
}

/* Reduce footer meta text size on mobile/desktop */
.meta-bar .small {
  font-size: 10px;
}

body.content-page .meta-bar {
  margin-top: 16px;
}

.content-ad {
  margin: 24px 0;
}

@media (max-height: 700px) {
  body:not(.content-page) .ad-unit {
    padding: 6px;
    margin-top: 8px;
  }

  body:not(.content-page) .ad-unit ins {
    min-height: 40px;
  }
}

@media (min-height: 900px) {
  body:not(.content-page) .ad-unit {
    aspect-ratio: 1 / 1;
    max-width: 320px;
    width: min(320px, calc(100% - 24px));
    margin-left: auto;
    margin-right: auto;
  }

  body:not(.content-page) .ad-unit ins {
    min-height: 280px;
    max-height: 320px;
  }
}

/* Mini countdown next to Start/Stop */
.mini-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(31, 41, 55, .6);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #e5e7eb;
  font-weight: 700;
}

/* PWA install banner styles removed; native browser UI is used */

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: #6b7280;
}

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

.btn.warn {
  background: var(--warn);
}

.btn.subtle {
  background: #374151;
}

.btn:disabled {
  background: #6b7280;
  cursor: not-allowed;
  opacity: .7;
}

.mobile-only {
  display: inline-flex;
}

.desktop-only {
  display: inline-flex;
}

@media (min-width: 900px) {
  .mobile-only {
    display: none;
  }
}

@media (max-width: 899px) {
  .desktop-only {
    display: none;
  }
}

.trust-panel {
  margin-top: 32px;
  padding: 16px 20px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.6);
}

.trust-panel h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.trust-panel p {
  margin-bottom: 12px;
}

.trust-panel ul {
  margin: 0;
  padding-left: 20px;
  list-style: disc;
}

.trust-panel li {
  margin-bottom: 8px;
}

/* Modal overlay for unified panels (privacy/mic/videos) */
.privacy-panel {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
  flex-direction: column;
  max-width: 720px;
  max-height: 80vh;
  margin: auto;
  padding: 14px;
  gap: 10px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.privacy-panel.open {
  display: flex;
}

.privacy-panel .privacy-content {
  overflow-y: auto;
}

/* Dim background when modal is open */
/* Background dim removed to avoid mobile interaction issues */

/* Countdown */
#countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .7);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

#countdown-text {
  font-size: clamp(4rem, 10vw, 10rem);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 20px rgba(0, 0, 0, .5);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1
  }

  50% {
    transform: scale(1.05);
    opacity: .75
  }

  100% {
    transform: scale(1);
    opacity: 1
  }
}

/* Loading overlay */
#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, .35);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: #fff;
  font-weight: 700;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    transform: scale(1.02);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    transform: scale(1);
  }
}

.pulse-btn {
  animation: pulse-glow 2s infinite;
}

/* Helpers */
.hidden {
  display: none !important;
}

/* Editor collapse (desktop only) */
@media (min-width: 900px) {
  #script-editor-panel.collapsed {
    display: none;
  }
}

/* LANDING HERO & MOBILE EDGE-TO-EDGE */
.landing-hero {
  padding: 4rem 2rem;
  text-align: center;
  max-width: 1200px;
  grid-column: 1 / -1;
  margin: 0 auto;
  width: 100%;
}

.landing-hero h1 {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  font-weight: 800;
}

.hero-subtext {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 4rem;
}

.value-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2rem;
}

.card {
  padding: 2rem;
  text-align: center;
  transition: transform 0.3s;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.03);
}

.card i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

.card h3 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--text-muted);
  font-size: 1rem;
}

@media (max-width: 899px) {
  .landing-hero {
    padding: 1.5rem 1.5rem 3rem;
  }

  .landing-hero h1 {
    font-size: 2.25rem;
    margin-top: 0;
    margin-bottom: 0;
  }

  .hero-subtext {
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100% !important;
    display: block !important;
  }

  .value-cards {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* SUPER MOBILE OVERRIDE - Zero Margin Edge-to-Edge */
  html body #main,
  html body #controls,
  html body #ad-panel-mobile,
  html body .meta-bar,
  html body .content-top-bar {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    left: 0 !important;
    right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  html body #main {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
  }

  html body.content-page #main {
    padding: 20px 12px !important;
  }

  html body #teleprompter-container {
    padding: 0 !important;
    margin: 0 !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
  }

  /* Hide extras during active recording on mobile */
  html body.is-recording #script-editor-panel,
  html body.is-recording #meta-bar,
  html body.is-recording #ad-panel-mobile {
    display: none !important;
  }
}