: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);
  --card-strong: 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;
  --counter-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

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

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);
  touch-action: pan-y pinch-zoom;
}

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;
}

.runtimeDiagnostic {
  position: fixed;
  right: 10px;
  bottom: calc(78px + var(--safe-bottom));
  z-index: 10001;
  width: min(92vw, 420px);
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(9, 17, 30, 0.92);
  color: rgba(222, 239, 255, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.runtimeDiagnosticTitle {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(141, 203, 255, 0.94);
}

#runtimeDiagnosticOutput {
  margin: 0;
  font-size: 11px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.shell {
  width: 100%;
  max-width: 760px;
  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.68);
  -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 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px;
  min-width: 0;
}

.intake-form {
  display: grid;
  gap: 16px;
  padding: 0;
}

.intake-card {
  gap: 1.1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.82)),
    radial-gradient(circle at top left, rgba(32, 168, 255, 0.08), transparent 42%);
}

.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;
}

.panelHeading {
  display: grid;
  gap: 0.35rem;
}

.panelEyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(19, 134, 218, 0.82);
}

.panelIntro {
  margin: 0;
  color: rgba(80, 96, 114, 0.92);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
}

.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: 10px 0 6px 2px;
}

.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;
}

#situation {
  min-height: 5.4rem;
}

.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: rgba(80, 96, 114, 0.9);
  line-height: 1.45;
  text-align: left;
  font-size: 0.96rem;
}

.voice-status:empty {
  display: none;
}

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

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

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

.voice-actions .ghost-button {
  background: rgba(255, 255, 255, 0.9);
}

.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: 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(32, 168, 255, 0.28);
}

.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;
}

.teleprompter-summary {
  margin: 0;
  color: rgba(80, 96, 114, 0.9);
  line-height: 1.38;
  font-size: 13px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(32, 168, 255, 0.08);
  border: 1px solid rgba(32, 168, 255, 0.12);
}

.teleprompter-summary:empty {
  display: none;
}

.resultWrap {
  position: relative;
  background:
    linear-gradient(180deg, var(--card-strong), rgba(255, 255, 255, 0.84)),
    radial-gradient(circle at top right, rgba(243, 154, 61, 0.08), transparent 34%);
}

.resultHeading {
  margin-bottom: 12px;
}

.resultTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.badgeCount {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.65);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 8px 12px;
  border-radius: 999px;
}

#result {
  min-height: 260px;
  width: 100%;
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--text);
  padding: 14px 14px;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.resultActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

#open-teleprompter {
  border: 0;
  background: linear-gradient(180deg, rgba(18, 37, 63, 0.96), rgba(9, 23, 42, 1));
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(9, 23, 42, 0.18);
}

@media (min-width: 960px) {
  .page {
    padding: 24px;
    padding-bottom: calc(18px + var(--counter-h) + var(--safe-bottom));
  }

  .shell {
    max-width: 880px;
  }

  .header {
    padding: 16px 22px 12px;
  }

  .main {
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 20px;
    padding: 22px;
    align-items: start;
  }

  .panel {
    padding: 22px;
  }

  .row2 {
    gap: 14px;
  }

  #result {
    min-height: 360px;
  }

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

.counterBar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 10px 18px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 -6px 24px rgba(31, 55, 84, 0.08);
  z-index: 9999;
}

body.teleprompter-open .counterBar {
  opacity: 0;
  pointer-events: none;
}

#counterText {
  font-size: 12px;
  font-weight: 700;
  color: rgba(23, 29, 42, 0.46);
  white-space: nowrap;
  max-width: calc(100vw - 36px);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

#counterText:empty {
  display: none;
}

.counterBtn {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 13px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.56);
  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;
  white-space: nowrap;
  min-width: 104px;
}

#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: 20000;
}

#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: 20000;
  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(82px, 11vw, 116px) 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)) 8px 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.35rem;
}

.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-rail-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.94);
  text-align: center;
  font-size: 0.96rem;
  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,
.teleprompter-rail-button.is-active {
  color: rgba(174, 235, 133, 0.96);
  background: rgba(174, 235, 133, 0.1);
  box-shadow: inset 0 0 0 1px rgba(174, 235, 133, 0.24);
}

.teleprompter-rail-button:disabled {
  opacity: 0.52;
  background: rgba(255, 255, 255, 0.02);
}

.teleprompter-speed-control {
  position: relative;
}

.teleprompter-speed-popover {
  position: absolute;
  left: calc(100% + 10px);
  bottom: 0;
  display: grid;
  gap: 0.45rem;
  min-width: 132px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(2, 6, 15, 0.96);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.teleprompter-speed-popover[hidden] {
  display: 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: 10rem;
  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: 38vh clamp(1.35rem, 3vw, 2.5rem) 34vh;
  scrollbar-width: none;
  position: relative;
  z-index: 2;
}

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

.teleprompter-script > * {
  max-width: 16ch;
}

.teleprompter-end-spacer {
  height: 54vh;
  min-height: 260px;
}

.teleprompter-line,
.teleprompter-placeholder {
  margin: 0 0 1.6rem;
  font-size: clamp(2.15rem, 4.2vw, 3.15rem);
  line-height: 1.18;
  letter-spacing: -0.03em;
  color: rgba(255, 255, 255, 0.28);
  text-shadow: none;
  transition: color 180ms ease, transform 180ms ease, opacity 180ms ease;
  opacity: 0.38;
}

.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.012);
  text-shadow: 0 0 26px rgba(174, 235, 133, 0.16);
  opacity: 1;
}

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

@media (max-width: 720px) {
  :root {
    --counter-h: 62px;
  }

  html,
  body {
    height: 100%;
  }

  body.app {
    overflow: hidden;
  }

  body {
    background:
      radial-gradient(1200px 600px at 10% 0%, rgba(32, 168, 255, 0.2) 0%, transparent 60%),
      radial-gradient(900px 600px at 90% 20%, rgba(32, 168, 255, 0.1) 0%, transparent 55%),
      var(--bg);
  }

  .page {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    padding-top: calc(var(--safe-top) + 24px);
    padding-bottom: 0;
    overflow: hidden;
  }

  .shell {
    max-width: none;
    width: 100vw;
    height: calc(100dvh - (var(--safe-top) + 24px));
    min-height: calc(100dvh - (var(--safe-top) + 24px));
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .main {
    padding: 12px;
    padding-bottom: calc(120px + var(--safe-bottom));
    grid-template-columns: 1fr;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    align-content: start;
  }

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

  .header {
    padding: 18px 14px 14px;
    background: rgba(248, 252, 255, 0.78);
  }

  .brand {
    gap: 10px;
  }

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

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

  .brandText p {
    font-size: 12px;
    line-height: 1.28;
    max-width: 18ch;
  }

  .header-button {
    min-height: 42px;
    padding-inline: 18px;
  }

  .panel {
    padding: 14px;
  }

  .panelIntro {
    max-width: none;
    font-size: 13px;
  }

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

  .teleprompter-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .teleprompter-reader {
    min-height: 0;
    order: 1;
  }

  .teleprompter-sidebar {
    order: 2;
    gap: 0.65rem;
    padding:
      10px
      10px
      calc(10px + env(safe-area-inset-bottom, 0px))
      10px;
    background: rgba(2, 6, 15, 0.94);
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .teleprompter-sidebar-group,
  .teleprompter-sidebar-group-top,
  .teleprompter-sidebar-group-middle,
  .teleprompter-sidebar-group-bottom,
  .teleprompter-sidebar-group-close {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
  }

  .teleprompter-sidebar-group-top {
    grid-column: span 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teleprompter-sidebar-group-middle {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .teleprompter-sidebar-group-close {
    grid-column: span 1;
  }

  .teleprompter-speed-control {
    width: 100%;
  }

  .teleprompter-speed-popover {
    left: auto;
    right: 0;
    bottom: calc(100% + 10px);
    min-width: min(240px, calc(100vw - 20px));
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teleprompter-rail-button {
    min-height: 46px;
    padding: 10px 8px;
    font-size: 0.88rem;
    border-radius: 13px;
  }

  .teleprompter-script {
    padding: 30vh 1.05rem 24vh;
  }

  .teleprompter-script > * {
    max-width: 17ch;
  }

  .teleprompter-end-spacer {
    height: 42vh;
    min-height: 180px;
  }

  .teleprompter-highlight-guide {
    height: 7.4rem;
  }

  .teleprompter-line,
  .teleprompter-placeholder {
    font-size: clamp(1.78rem, 7vw, 2.45rem);
    line-height: 1.17;
  }

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

  .resultActions {
    justify-content: stretch;
  }

  .resultActions .ghost-button,
  .resultActions #open-teleprompter {
    width: 100%;
  }

  #counterText {
    max-width: calc(100vw - 54px);
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  :root {
    --counter-h: 60px;
  }

  .main {
    padding: 10px;
  }

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

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

  .runtimeDiagnostic {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: calc(74px + var(--safe-bottom));
  }

  #counterText {
    max-width: calc(100vw - 46px);
  }

  #situation {
    min-height: 5rem;
  }

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

  #plusModal .modalBanner {
    padding: 14px;
  }

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

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

  .teleprompter-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .teleprompter-sidebar-group-top,
  .teleprompter-sidebar-group-middle,
  .teleprompter-sidebar-group-close {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teleprompter-sidebar-group-top,
  .teleprompter-sidebar-group-middle,
  .teleprompter-sidebar-group-close {
    grid-column: span 2;
  }

  .teleprompter-speed-popover {
    grid-column: span 2;
    min-width: min(260px, calc(100vw - 20px));
  }

  .teleprompter-rail-button {
    min-height: 42px;
    padding: 11px 8px;
    font-size: 0.86rem;
  }

  .teleprompter-script {
    padding: 28vh 0.95rem 22vh;
  }

  .teleprompter-highlight-guide {
    height: 7rem;
  }

  .teleprompter-line,
  .teleprompter-placeholder {
    font-size: clamp(1.62rem, 7.1vw, 2.1rem);
  }
}
