/* Screen + block rendering. Shared by the editor canvas and (M2) the runtime. */

.screen-frame {
  width: min(560px, 92%);
  background: var(--s-bg, #fff);
  color: var(--s-text, #12141c);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  font-family: var(--s-font);
  min-height: 340px;
  max-height: 78vh;
  overflow-y: auto;
}

.screen { display: block; }
.screen-body { display: flex; flex-direction: column; gap: 14px; }
.screen-empty { color: var(--s-muted); text-align: center; padding: 40px 0; font-size: 14px; }

.blk-pick { display: block; text-decoration: none; color: inherit; border-radius: var(--s-radius); }
.blk-pick:hover { outline: 2px solid rgba(79, 70, 229, 0.35); outline-offset: 6px; }

.blk { display: block; }
.blk-title { margin: 0; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.blk-text { margin: 0; line-height: 1.55; color: var(--s-text); font-size: 15px; }
/* inline formatting: only links need a style, bold/italic are browser defaults */
.blk-title a, .blk-text a { color: var(--s-accent); text-decoration: underline; text-underline-offset: 2px; }
.blk-title a:hover, .blk-text a:hover { text-decoration-thickness: 2px; }

/* choice + scale share the fieldset chrome */
.blk-fieldset { border: 0; margin: 0; padding: 0; }
.blk-fieldset legend { font-weight: 600; margin-bottom: 10px; font-size: 15px; }
.req { color: #e5484d; }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border: 1px solid #e3e6ef; border-radius: 10px; cursor: pointer; background: #fff;
  transition: border-color 120ms, background 120ms;
}
.opt:hover { border-color: #c9cede; background: #fafbff; }
.opt input { accent-color: var(--s-accent); }
.opt-label { flex: 1; font-size: 15px; }
.opt-key { color: var(--s-muted); font-size: 12px; border: 1px solid #e3e6ef; border-radius: 6px; padding: 1px 6px; }

.pic-grid { display: grid; gap: 10px; }
.pic-card {
  border: 1px solid #e3e6ef; border-radius: 12px; padding: 18px 12px; background: #fff;
  display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px;
}
.pic-card:hover { border-color: #c9cede; background: #fafbff; }

.blk-input { display: block; }
.blk-input > label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 15px; }
.blk-input input[type="text"],
.blk-input input[type="email"],
.blk-input input[type="tel"],
.blk-input input[type="number"],
.blk-input input[type="date"],
.blk-input input[type="url"],
.blk-input input[type="file"],
.blk-input textarea,
.blk-input select {
  width: 100%; padding: 11px 13px; border: 1px solid #e3e6ef; border-radius: 10px;
  background: #fff; color: var(--s-text); font: inherit; outline: none;
}
.blk-input input:focus, .blk-input textarea:focus, .blk-input select:focus { border-color: var(--s-accent); }

.scale-track { display: flex; gap: 6px; flex-wrap: wrap; }
.scale-cell {
  flex: 1; min-width: 44px; text-align: center; border: 1px solid #e3e6ef; border-radius: 10px;
  padding: 12px 6px; cursor: pointer; background: #fff; font-size: 14px;
}
.scale-cell:hover { border-color: var(--s-accent); color: var(--s-accent); }
.scale-cell input { display: none; }
.scale-labels { display: flex; justify-content: space-between; color: var(--s-muted); font-size: 12px; margin-top: 8px; }

.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--s-accent); }
.slider-row output { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 56px; text-align: right; }

.blk-button {
  width: 100%; padding: 13px 18px; border: 0; border-radius: 10px;
  background: var(--s-accent); color: var(--s-accent-text); font: inherit; font-weight: 600;
  font-size: 15px; cursor: pointer;
}
.blk-button:hover { filter: brightness(1.06); }

.blk-loader { text-align: center; padding: 30px 0; color: var(--s-muted); }
.blk-loader p { margin: 14px 0 0; font-size: 14px; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto; border-radius: 50%;
  border: 3px solid #e3e6ef; border-top-color: var(--s-accent);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.blk-image { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.blk-image.placeholder {
  border: 1px dashed #c9cede; border-radius: 10px; padding: 34px 10px;
  text-align: center; color: #8b93a3; font-size: 13px;
}

/* ---------------- M4 blocks ---------------- */
.blk-sep { display: flex; align-items: center; gap: 12px; color: var(--s-muted); font-size: 12px; }
.blk-sep::before, .blk-sep::after { content: ""; flex: 1; height: 1px; background: #e3e6ef; }
.blk-sep span { text-transform: uppercase; letter-spacing: .08em; }

.blk-progress { display: flex; align-items: center; gap: 10px; }
.blk-progress-track { flex: 1; height: 8px; background: #eceff7; border-radius: 99px; overflow: hidden; }
.blk-progress-track span { display: block; height: 100%; background: var(--s-accent); border-radius: 99px; transition: width 220ms ease; }
.blk-progress em { font-size: 12px; color: var(--s-muted); font-style: normal; font-variant-numeric: tabular-nums; }
.blk-progress-text { margin: 0; text-align: center; color: var(--s-muted); font-size: 13px; letter-spacing: .02em; }

.blk-steps { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; justify-content: center; flex-wrap: wrap; }
.blk-step { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--s-muted); }
.blk-step .dot {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid #e3e6ef;
  display: grid; place-items: center; font-size: 11px; background: #fff;
}
.blk-step.is-active .dot { border-color: var(--s-accent); color: var(--s-accent); font-weight: 700; }
.blk-step.is-done .dot { background: var(--s-accent); color: var(--s-accent-text); border-color: var(--s-accent); }
.blk-step em { font-style: normal; }

.blk-typewriter { margin: 0; font-size: 17px; font-weight: 600; }
.blk-typewriter span::after { content: "|"; margin-left: 2px; animation: caret 900ms steps(1) infinite; color: var(--s-accent); }
@keyframes caret { 50% { opacity: 0; } }

.blk-acc { display: flex; flex-direction: column; gap: 8px; }
.blk-acc-item { border: 1px solid #e3e6ef; border-radius: 10px; padding: 10px 14px; background: #fff; }
.blk-acc-item summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.blk-acc-body { color: var(--s-muted); font-size: 14px; margin-top: 8px; line-height: 1.5; }

.blk-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.blk-checklist li { display: flex; gap: 9px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.blk-list-icon {
  flex: 0 0 20px; height: 20px; border-radius: 50%; background: rgba(79, 70, 229, .12);
  color: var(--s-accent); font-size: 11px; display: grid; place-items: center; font-weight: 700; margin-top: 2px;
}
.blk-list { margin: 0; padding-left: 20px; color: var(--s-text); font-size: 15px; line-height: 1.7; }

.blk-links { display: flex; gap: 16px; flex-wrap: wrap; }
.blk-link { color: var(--s-accent); font-size: 13px; text-decoration: none; border-bottom: 1px solid transparent; }
.blk-link:hover { border-bottom-color: currentColor; }

.blk-logo { text-align: center; }
.blk-logo img { display: inline-block; height: auto; }
.blk-logo-ph {
  display: inline-grid; place-items: center; height: 40px; border: 1px dashed #c9cede;
  border-radius: 8px; color: #8b93a3; font-size: 11px; letter-spacing: .12em;
}
.blk-logobar { display: grid; gap: 12px; align-items: center; }
.blk-logobar-item { text-align: center; color: #8b93a3; font-size: 12px; }
.blk-logobar-item img { max-width: 100%; max-height: 34px; filter: grayscale(1); opacity: .8; }

.blk-avatar { display: flex; flex-direction: column; gap: 4px; }
.blk-avatar img, .blk-avatar-ph {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #eceff7;
}
.blk-avatar strong { font-size: 15px; }
.blk-avatar em { font-style: normal; color: var(--s-muted); font-size: 13px; }

.blk-video { position: relative; width: 100%; padding-top: 56.25%; border-radius: 12px; overflow: hidden; background: #000; }
.blk-video iframe, .blk-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blk-video.placeholder { padding-top: 0; height: 120px; display: grid; place-items: center; background: #f3f5fa; color: #8b93a3; font-size: 13px; }

.blk-carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.blk-carousel.placeholder { display: grid; place-items: center; color: #8b93a3; font-size: 13px; border: 1px dashed #c9cede; border-radius: 10px; }
.blk-slide { flex: 0 0 78%; margin: 0; position: relative; scroll-snap-align: center; border-radius: 12px; overflow: hidden; background: #f3f5fa; }
.blk-slide img { width: 100%; height: 100%; object-fit: cover; }
.blk-slide figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; font-size: 12px;
  color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .55));
}

.blk-tic { display: flex; gap: 16px; align-items: center; flex-wrap: nowrap; }
.blk-tic img, .blk-tic-ph { width: 100%; border-radius: 10px; object-fit: cover; }
.blk-tic-ph { display: grid; place-items: center; height: 120px; background: #f3f5fa; color: #8b93a3; font-size: 12px; }
.blk-tic-text { flex: 1; }
.blk-tic-text h2 { margin: 0 0 6px; font-size: 18px; }
.blk-tic-text p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; color: var(--s-muted); }

.blk-sticky {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--s-card); border: 1px solid #e3e6ef; border-radius: 12px; font-size: 13px;
}
.blk-sticky .blk-button { width: auto; padding: 9px 14px; font-size: 13px; white-space: nowrap; }

.blk-cookie {
  background: var(--s-card); border: 1px solid #e3e6ef; border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px; font-size: 13px;
}
.blk-cookie p { margin: 0; color: var(--s-muted); }
.blk-cookie-actions { display: flex; gap: 8px; }
.btn-ish {
  border: 1px solid #e3e6ef; background: #fff; color: var(--s-text); border-radius: 8px;
  padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none;
  display: inline-block;
}
.btn-ish.primary { background: var(--s-accent); color: var(--s-accent-text); border-color: var(--s-accent); }

.blk-html-raw { border: 1px solid #e3e6ef; border-radius: 10px; padding: 10px; font-size: 13px; }
.blk-html-raw pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--s-muted); font-size: 12px; }
.blk-html-flag { color: #b26a00; background: #fff6e5; border-radius: 6px; padding: 4px 8px; margin-bottom: 8px; font-size: 11px; }

.blk-ai { border: 1px dashed rgba(79, 70, 229, .5); border-radius: 10px; padding: 12px; background: rgba(79, 70, 229, .04); }
.blk-ai p { margin: 6px 0 0; font-size: 15px; }
.blk-ai em { color: var(--s-muted); font-size: 11px; font-style: normal; }
.blk-ai-badge { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--s-accent); }

.blk-calendly, .blk-pay {
  border: 1px solid #e3e6ef; border-radius: 12px; padding: 14px; display: flex;
  flex-direction: column; gap: 8px; background: #fff;
}
.blk-calendly strong { font-size: 15px; }
.blk-calendly em, .blk-pay-note { color: var(--s-muted); font-size: 11px; font-style: normal; }
.blk-pay-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.blk-pay-row strong { font-variant-numeric: tabular-nums; }
.blk-pay .blk-button[disabled] { opacity: .55; cursor: not-allowed; }

.blk-phone-row { display: flex; gap: 8px; }
.blk-phone-row .blk-country { flex: 0 0 84px; }
.blk-consent { display: flex; flex-direction: column; gap: 6px; }
.blk-consent .opt { border: 0; padding: 0; }
.blk-consent-link { font-size: 12px; color: var(--s-accent); }

.rate-track { display: flex; gap: 6px; }
.rate-cell {
  flex: 1; text-align: center; border: 1px solid #e3e6ef; border-radius: 10px; padding: 10px 4px;
  cursor: pointer; background: #fff; font-size: 20px; color: #c9cede; line-height: 1;
}
.rate-cell:hover { color: var(--s-accent); border-color: var(--s-accent); }
.rate-cell input { display: none; }
.rate-cell input:checked + span { color: #f5b301; }
.rate-cell:has(input:checked) { border-color: var(--s-accent); background: #fffdf2; }

.blk-address { display: flex; flex-direction: column; gap: 8px; }
.blk-address .input, .blk-address input {
  width: 100%; padding: 11px 13px; border: 1px solid #e3e6ef; border-radius: 10px;
  background: #fff; color: var(--s-text); font: inherit;
}
.blk-address-row { display: flex; gap: 8px; }
.blk-address-row input:first-child { flex: 0 0 34%; }

.blk-upload { display: flex; flex-direction: column; gap: 6px; }
.blk-upload > label { font-weight: 600; font-size: 15px; }
.blk-upload input[type="file"] {
  border: 1px dashed #c9cede; border-radius: 10px; padding: 18px 12px; background: #fafbff;
  font: inherit; font-size: 13px; color: var(--s-muted); width: 100%;
}
.blk-upload .hint-sm { color: var(--s-muted); font-size: 11px; }

.blk-signature { display: flex; flex-direction: column; gap: 6px; }
.blk-signature > label { font-weight: 600; font-size: 15px; }
.sig-pad {
  width: 100%; height: 140px; border: 1px dashed #c9cede; border-radius: 10px;
  background: #fff; touch-action: none; cursor: crosshair; display: block;
}
.sig-actions { text-align: right; }

.blk-nav { display: flex; gap: 10px; }
.blk-nav .blk-button { flex: 1; }
.blk-button.ghost { background: transparent; color: var(--s-accent); border: 1px solid rgba(79, 70, 229, .35); }

/* ---------------- containers ---------------- */
.blk-container { display: flex; flex-direction: column; gap: 12px; }
.blk-container-empty, .blk-layout-empty, .blk-form-empty {
  margin: 0; padding: 14px; border: 1px dashed #c9cede; border-radius: 8px;
  color: #8b93a3; font-size: 12px; text-align: center;
}
.blk-layout { display: grid; align-items: start; }
.blk-layout > * { min-width: 0; }
.blk-form { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.blk-form-fields { display: flex; flex-direction: column; }

/* editor: containers get a small label instead of a wrapping link */
.blk-pick-wrap { display: block; }
.blk-pick-label {
  display: inline-block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; margin-bottom: 4px;
}
.blk-pick-label:hover { color: var(--accent); }
.block-line { display: flex; align-items: center; gap: 4px; }
.block-line .block-row { flex: 1; }

/* editor: controls are inert inside the canvas */
.is-preview, .blk .is-preview { pointer-events: none; }
.screen-frame input, .screen-frame textarea, .screen-frame select, .screen-frame button { pointer-events: none; }

/* ---------------- inspector extras ---------------- */
.inspector-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.inspector-head h3 { margin: 0; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.row-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.block-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); margin-bottom: 6px; color: var(--text); text-decoration: none; font-size: 13px;
}
.block-row:hover { background: var(--panel-2); border-color: #3a4352; }
.block-row .idx { color: var(--muted); width: 16px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.hint-sm { color: var(--muted); font-size: 11px; margin-top: 4px; }
.toggle-row { display: flex; align-items: center; gap: 8px; }
.toggle-row input { accent-color: var(--accent); }
/* "Remove saved token" checkbox that sits under a write-only secret field */
.check-inline { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.check-inline input { accent-color: var(--accent); }
.count { color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.rule-list { margin-bottom: 12px; }
.rule-row {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); margin-bottom: 6px; font-size: 12px; line-height: 1.45;
}
.rule-text { flex: 1; word-break: break-word; }
.alert {
  border: 1px solid var(--accent-2); color: var(--accent-2); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; margin-bottom: 10px;
}

/* ---------------- responses table ---------------- */
.page.wide { max-width: 1200px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 20px; }
.page-actions { display: flex; gap: 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.resp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.resp-table th, .resp-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.resp-table th { background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
.resp-table tr:last-child td { border-bottom: 0; }
.resp-table td.num { color: var(--muted); }
.resp-table td.when { color: var(--muted); font-variant-numeric: tabular-nums; }
.resp-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

.blk-calendly-frame {
  width: 100%; border: 1px solid #e3e6ef; border-radius: 12px; background: #fff;
}
.blk-calendly a { color: var(--s-accent); font-size: 12px;
}

/* variants */
.rail-variant {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 10px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px;
}
.rail-variant:first-child { border-top: 0; margin-top: 0; }
.variant-list { display: grid; gap: 8px; margin-bottom: 12px; }
.variant-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.variant-name, .variant-share { display: flex; gap: 4px; align-items: center; }
.variant-row .input { padding: 5px 8px; font-size: 12px; }
.variant-share .input { width: 62px; }
.variant-share .pct { color: var(--muted); font-size: 11px; }
.variant-row .pill { grid-column: 1 / -1; justify-self: start; }

/* editor drag and drop */
.dnd-item { cursor: grab; }
.dnd-item:active { cursor: grabbing; }
.is-dragging { opacity: .4; }
.is-drop-target { outline: 2px dashed var(--s-accent, #4f46e5); outline-offset: 4px; border-radius: 10px; }

/* per-viewport visibility (universal block settings) */
@media (min-width: 820px) { .blk.hide-desktop { display: none !important; } }
@media (max-width: 819.98px) { .blk.hide-mobile { display: none !important; } }
@media (min-width: 641px) and (max-width: 1024px) { .blk.hide-tablet { display: none !important; } }
.blk.hide-all { display: none !important; }

/* entrance animations */
@keyframes hf-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hf-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hf-left { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes hf-zoom { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

.blk.anim-fade { animation: hf-fade .45s ease both; }
.blk.anim-up { animation: hf-up .5s cubic-bezier(.2, .7, .3, 1) both; }
.blk.anim-left { animation: hf-left .5s cubic-bezier(.2, .7, .3, 1) both; }
.blk.anim-zoom { animation: hf-zoom .45s cubic-bezier(.2, .7, .3, 1) both; }

/* a funnel screen replays its animations when it becomes the active step */
.rt-screen:not(.is-active) .blk[class*="anim-"] { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .blk[class*="anim-"] { animation: none !important; }
}
