:root {
  --bg: #f7f4eb;
  --card: rgba(255, 255, 255, 0.84);
  --surface: rgba(255, 255, 255, 0.42);
  --input-bg: rgba(255, 255, 255, 0.92);
  --text: #171d2a;
  --muted: #506072;
  --line: rgba(23, 29, 42, 0.08);
  --line-strong: rgba(23, 29, 42, 0.12);
  --accent: #20a8ff;
  --accent-strong: #1386da;
  --accent-soft: rgba(32, 168, 255, 0.1);
  --success: #1386da;
  --teleprompter-bg: #081427;
  --teleprompter-line: rgba(255, 255, 255, 0.92);
  --teleprompter-muted: rgba(255, 255, 255, 0.42);
  --radius: 22px;
  --pad: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "SF Pro Text",
    "SF Pro Display",
    system-ui,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background:
    radial-gradient(1200px 600px at 10% 0%, rgba(32, 168, 255, 0.16) 0%, transparent 60%),
    radial-gradient(900px 600px at 90% 20%, rgba(32, 168, 255, 0.08) 0%, transparent 55%),
    radial-gradient(700px 420px at 22% 88%, rgba(243, 154, 61, 0.12) 0%, transparent 52%),
    var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  min-height: 100vh;
  padding: 18px;
  padding-bottom: calc(16px + 78px + var(--safe-bottom));
}

.shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(31, 55, 84, 0.12);
  overflow: hidden;
}

.preview-app-mobile body {
  background: var(--bg);
}

.preview-app-mobile .shell {
  max-width: 430px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.56);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: clamp(44px, 10vw, 56px);
  height: clamp(44px, 10vw, 56px);
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.brandText {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brandText strong {
  display: block;
  font-size: 1.12rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.brandText p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  max-width: 24ch;
}

.headerActions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.header-button {
  min-height: 44px;
  border-radius: 999px;
  padding-inline: 22px;
}

.main {
  padding: 12px 16px 16px;
}

.intake-form {
  display: grid;
  gap: 16px;
  padding: 0 0 calc(6.75rem + var(--safe-bottom));
}

.intake-card {
  gap: 1.25rem;
}

.app-section {
  display: grid;
  gap: 1rem;
  padding: 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: 0 14px 40px rgba(31, 55, 84, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  min-width: 0;
}

.section-heading {
  display: grid;
  gap: 0.25rem;
  text-align: left;
}

.intake-heading {
  justify-items: center;
  text-align: center;
  margin-bottom: 0.1rem;
}

.section-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--success);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.intake-heading h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  max-width: 11ch;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field span {
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  color: rgba(0, 0, 0, 0.62);
  margin: 14px 0 8px 2px;
}

.field-hint {
  margin-top: -0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--input-bg);
  color: var(--text);
  padding: 14px 14px;
  min-height: 3.4rem;
  font-size: 16px;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.field textarea {
  resize: vertical;
  min-height: 8rem;
  padding-top: 1rem;
}

.field-large textarea {
  min-height: 8rem;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #7a8fb3;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(32, 168, 255, 0.38);
  box-shadow: 0 0 0 4px rgba(32, 168, 255, 0.08);
}

.voice-section {
  gap: 0.85rem;
}

.voice-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  text-align: left;
}

.voice-preview {
  margin: 0;
  min-height: 0;
  display: none;
  padding: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.voice-preview.has-content {
  display: block;
  min-height: 7rem;
}

.voice-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.speed-button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.toolbar-button:hover {
  opacity: 0.92;
}

.chip.is-active {
  border-color: rgba(10, 102, 255, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.primary-button,
.secondary-button,
.ghost-button,
.speed-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.3rem;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 16px;
  font-weight: 800;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  line-height: 1;
  box-shadow: none;
}

.primary-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
}

.secondary-button,
.ghost-button,
.speed-button {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--line);
  color: var(--text);
}

.compact-button {
  width: 100%;
  min-width: 0;
}

.voice-actions .primary-button {
  min-height: 58px;
  border-radius: 22px;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.voice-actions .secondary-button {
  min-height: 58px;
  border-radius: 22px;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.speed-button.is-active {
  border-color: rgba(32, 168, 255, 0.26);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.row2 > .field {
  min-width: 0;
}

.delivery-copy {
  display: grid;
  gap: 0.28rem;
}

.teleprompter-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.counterBar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px calc(12px + var(--safe-bottom)) 14px;
  background: rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -12px 40px rgba(31, 55, 84, 0.12);
  z-index: 25;
}

#counterText {
  font-size: 15px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.78);
  white-space: nowrap;
}

.counterBtn {
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#plusBtn {
  margin-left: auto !important;
}

#plusModal[hidden] {
  display: none !important;
}

#plusModal.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

#plusModal .modalCard {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

#plusModal .modalBanner {
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(32, 168, 255, 0.2), rgba(243, 154, 61, 0.08));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#plusModal .modalBannerInner {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

#plusModal .modalLogo {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
  background: rgba(32, 168, 255, 0.12);
  border: 1px solid rgba(32, 168, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#plusModal .modalLogo img,
#plusModal .modalLogoImg {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

#plusModal .modalTitle {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: rgba(0, 0, 0, 0.88);
  line-height: 1.2;
}

#plusModal .modalSub {
  font-size: 13px;
  margin-top: 3px;
  color: rgba(0, 0, 0, 0.62);
  line-height: 1.3;
}

#plusModal .modalBody {
  padding: 16px 18px 12px;
}

#plusModal .modalList {
  margin: 0 0 12px 18px;
  padding: 0;
  color: rgba(0, 0, 0, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

#plusModal .modalList li {
  margin: 6px 0;
}

#plusModal .modalLabel {
  display: block;
  font-size: 12px;
  margin: 12px 0 6px;
  color: rgba(0, 0, 0, 0.62);
}

#plusModal .modalInput {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.92);
  outline: none;
  font-size: 15px;
}

#plusModal .modalInput::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

#plusModal .modalInput:focus {
  border-color: rgba(32, 168, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(32, 168, 255, 0.16);
}

#plusModal .modalFine {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  margin-top: 10px;
  line-height: 1.35;
  text-align: center;
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}

#plusModal #deviceLimitMsg {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(32, 168, 255, 0.22);
  background: rgba(32, 168, 255, 0.08);
  color: rgba(0, 0, 0, 0.78);
  line-height: 1.4;
}

#plusModal #deviceLimitMsg strong {
  color: rgba(0, 0, 0, 0.86);
}

#plusModal #manageDevicesLink {
  margin-top: 10px;
  width: 100%;
}

#plusModal .modalActions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 18px 18px;
}

#plusModal .modalActions button {
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 650;
}

body.teleprompter-open {
  overflow: hidden;
}

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

.teleprompter-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: rgba(3, 10, 23, 0.82);
  backdrop-filter: blur(20px);
}

.teleprompter-modal {
  width: 100%;
  height: 100%;
  background: var(--teleprompter-bg);
}

.teleprompter-layout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: clamp(88px, 14vw, 132px) minmax(0, 1fr);
}

.teleprompter-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: 0;
  padding: max(18px, env(safe-area-inset-top, 0px)) 10px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #02060f;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.teleprompter-sidebar-group {
  display: grid;
  gap: 0.2rem;
}

.teleprompter-sidebar-group-top {
  padding-top: 0.3rem;
}

.teleprompter-sidebar-group-middle {
  gap: 0.45rem;
}

.teleprompter-sidebar-group-bottom {
  margin-top: auto;
  gap: 0.45rem;
}

.teleprompter-sidebar-group-close {
  margin-top: 0.45rem;
}

.teleprompter-speed-list {
  display: grid;
  gap: 0.2rem;
}

.teleprompter-rail-button {
  display: block;
  width: 100%;
  padding: 14px 8px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  text-align: left;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.01em;
  border-radius: 14px;
}

.teleprompter-rail-button:hover,
.teleprompter-rail-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.teleprompter-rail-button.speed-button.is-active,
.teleprompter-toggle.is-active {
  color: rgba(174, 235, 133, 0.96);
}

.teleprompter-toggle {
  cursor: pointer;
}

.teleprompter-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.teleprompter-card,
.teleprompter-panel {
  min-height: 0;
}

.teleprompter-reader {
  min-width: 0;
  background: linear-gradient(180deg, rgba(12, 19, 33, 0.98), rgba(8, 14, 28, 1));
}

.teleprompter {
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
}

.teleprompter-highlight-guide {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 11rem;
  transform: translateY(-50%);
  border-top: 1px solid rgba(174, 235, 133, 0.34);
  border-bottom: 1px solid rgba(174, 235, 133, 0.34);
  background: linear-gradient(
    180deg,
    rgba(174, 235, 133, 0.04),
    rgba(174, 235, 133, 0.1),
    rgba(174, 235, 133, 0.04)
  );
  pointer-events: none;
  z-index: 1;
}

.teleprompter::before,
.teleprompter::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 24%;
  pointer-events: none;
  z-index: 3;
}

.teleprompter::before {
  top: 0;
  background: linear-gradient(180deg, rgba(8, 14, 28, 0.96) 0%, rgba(8, 14, 28, 0.7) 36%, rgba(8, 14, 28, 0) 100%);
}

.teleprompter::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(8, 14, 28, 0.96) 0%, rgba(8, 14, 28, 0.7) 36%, rgba(8, 14, 28, 0) 100%);
}

.teleprompter-script {
  height: 100%;
  overflow-y: auto;
  padding: 26vh 2.25rem;
  scrollbar-width: none;
  position: relative;
  z-index: 2;
}

.teleprompter-script::-webkit-scrollbar {
  display: none;
}

.teleprompter-line,
.teleprompter-placeholder {
  margin: 0 0 1.6rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.22;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.24);
  text-shadow: none;
  transition: color 180ms ease, transform 180ms ease, opacity 180ms ease;
  opacity: 0.34;
}

.teleprompter-line.is-far {
  color: rgba(255, 255, 255, 0.44);
  opacity: 0.56;
}

.teleprompter-line.is-near {
  color: rgba(255, 255, 255, 0.78);
  opacity: 0.86;
}

.teleprompter-line.is-active {
  color: rgba(205, 255, 165, 0.98);
  transform: scale(1.01);
  text-shadow: 0 0 24px rgba(174, 235, 133, 0.14);
  opacity: 1;
}

.teleprompter-placeholder {
  padding-top: 0;
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

  .row2 {
    grid-template-columns: 1fr;
  }

  .header {
    padding: 14px;
  }

  .brandText strong {
    font-size: 1.05rem;
  }

  .teleprompter-overlay-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .teleprompter-layout {
    grid-template-columns: clamp(92px, 20vw, 112px) minmax(0, 1fr);
  }

  .teleprompter-sidebar {
    gap: 0.9rem;
    padding-inline: 8px;
  }

  .teleprompter-rail-button {
    padding: 12px 6px;
    font-size: 0.94rem;
  }

  .teleprompter-script {
    padding: 26vh 1.35rem;
  }

  .voice-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .counterBtn {
    max-width: 118px;
    font-size: 14px;
  }

  #counterText {
    max-width: 48vw;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .page {
    padding: 0;
    padding-bottom: calc(10px + 74px + var(--safe-bottom));
  }

  .shell {
    border-radius: 0;
    min-height: 100vh;
  }

  .main {
    padding: 12px;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .counterBar {
    padding: 10px 12px calc(10px + var(--safe-bottom)) 12px;
  }

  .counterBtn {
    height: 40px;
    padding: 0 10px;
    max-width: 112px;
  }

  #counterText {
    max-width: 44vw;
  }

  #plusModal .modalCard {
    border-radius: 18px;
  }

  #plusModal .modalBanner {
    padding: 14px;
  }

  #plusModal .modalBody {
    padding: 14px 14px 10px;
  }

  #plusModal .modalActions {
    padding: 10px 14px 14px;
  }
}
