/* ---------- Details: font cards & logo ---------- */
fieldset.fontpick { border: 0; padding: 0; margin: 16px 0 0; }
fieldset.fontpick legend { font-weight: 500; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.font-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.font-card { position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 16px 16px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font-weight: 400; transition: border-color .15s, box-shadow .15s; }
.font-card:hover { border-color: #d6cfc4; }
.font-card.on { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.font-card input { position: absolute; opacity: 0; pointer-events: none; }
.font-card:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--pink) 55%, transparent); outline-offset: 2px; }
.fc-name { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.font-card.on .fc-name::after { content: " ✓ chosen"; color: var(--pink-ink, #9c2f68); }
.fc-head { font-family: var(--fh); font-weight: 600; font-size: 1.35rem; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.fc-body { font-family: var(--fb); font-size: .95rem; line-height: 1.5; color: var(--ink-2); }
.fc-fonts { font-size: .75rem; color: var(--ink-3); margin-top: 4px; }
.logo-prev { display: inline-grid; place-items: center; height: 64px; min-width: 64px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: repeating-conic-gradient(#f2efea 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.logo-prev img { max-height: 46px; max-width: 200px; width: auto; }
@media (max-width: 760px) { .font-cards { grid-template-columns: 1fr; } }

/* ---------- Lessons outline ---------- */
.outline { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.outline-side { position: sticky; top: 80px; padding: 18px; }
.outline-side .btn + .btn { margin-top: 8px; }
.ed-label { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.cover-prev { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.empty-cover { display: grid; place-items: center; background: #faf8f5; color: var(--ink-3); font-size: .85rem; border-style: dashed; }
.les-ico { width: 22px; text-align: center; color: var(--ink-3); }
.lesson-row .btn.sm { min-height: 32px; padding: 6px 12px; }
@media (max-width: 820px) { .outline { grid-template-columns: 1fr; } .outline-side { position: static; } }

/* ---------- Lesson editor (full screen) ---------- */
body.ed-open { overflow: hidden; }
.ed { position: fixed; inset: 0; z-index: 50; background: var(--cream); display: flex; flex-direction: column; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); min-height: 60px; }
.ed-status { font-size: .85rem; color: var(--ok); }
.ed-main { flex: 1; display: grid; grid-template-columns: 250px 1fr; min-height: 0; }
.ed-tools { background: #fff; border-right: 1px solid var(--line); padding: 18px 16px; overflow-y: auto; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ed-el { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 500 .82rem var(--font-body); color: var(--ink); cursor: pointer; }
.ed-el span { font-size: 1.15rem; line-height: 1; color: var(--ink-2); }
.ed-el:hover { border-color: var(--pink); background: color-mix(in srgb, var(--pink) 5%, #fff); }
.ed-tools .hint { margin: 0 0 22px; }
.ed-canvas { overflow: auto; padding: 18px; }
.ed-frame { background: #fbfaf8; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; font-family: var(--font-body); min-height: 100%; }
.ed-frame .player { min-height: 0; }
.ed-frame .side { position: static; max-height: none; }
.ed-addles { display: block; margin: 2px 20px 6px 20px; padding: 6px 0; background: none; border: 0; color: var(--ink-3); font: 500 .85rem var(--font-body); cursor: pointer; }
.ed-addles:hover { color: var(--ink); }
.ed-frame .stage-nav .btn { pointer-events: none; opacity: .8; }

.ed-toolbar { position: sticky; top: -18px; z-index: 2; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin: -8px 0 20px; box-shadow: 0 4px 14px rgba(33,33,33,.06); }
.ed-toolbar button { min-width: 34px; height: 34px; padding: 0 8px; border: 0; border-radius: 7px; background: none; cursor: pointer; font: 600 .9rem var(--font-body); color: var(--ink); }
.ed-toolbar button:hover { background: #f4f1ec; }
.ed-toolbar button.on { background: color-mix(in srgb, var(--brand) 18%, #fff); }
.ed-toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }

.ed-title { outline: none; border-radius: 6px; }
.ed-body { outline: none; min-height: 260px; padding: 4px 0 24px; border-radius: 6px; }
.ed-title:hover, .ed-body:hover { box-shadow: 0 0 0 6px #fff, 0 0 0 7px var(--line); background: #fff; }
.ed-title:focus, .ed-body:focus { box-shadow: 0 0 0 6px #fff, 0 0 0 8px color-mix(in srgb, var(--brand) 45%, transparent); background: #fff; }
.ed-title:empty::before { content: attr(data-ph); color: var(--ink-3); }
.ed-body:has(> p:only-child > br:only-child)::before { content: attr(data-ph); color: var(--ink-3); position: absolute; pointer-events: none; }
.ed-body img { cursor: pointer; }
.ed-body img:hover { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }
.ed-body a { cursor: pointer; }
.ed-embed { position: relative; margin: 1.2em 0; }
.ed-embed .video { margin: 0; }
.ed-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 14px; }
.ed-placeholder { display: block; width: 100%; padding: 28px 16px; margin-bottom: 24px; border: 2px dashed var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: 500 1rem var(--font-body); color: var(--ink-2); }
.ed-placeholder:hover { border-color: var(--brand); color: var(--ink); }
.ed-placeholder .small { display: block; font-weight: 400; margin-top: 4px; }
.ed-under { display: flex; gap: 8px; margin: -14px 0 24px; }
.ed-pop { position: fixed; z-index: 55; display: flex; gap: 6px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.ed-modal { position: fixed; inset: 0; z-index: 60; background: rgba(33,33,33,.45); display: grid; place-items: center; padding: 16px; }
.ed-modal .card { width: 100%; max-width: 460px; }
.ed-err { color: var(--bad); font-size: .88rem; margin-top: 10px; min-height: 1em; }

@media (max-width: 980px) {
  .ed-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ed-tools { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; display: flex; gap: 8px; overflow-x: auto; }
  .ed-tools .ed-label, .ed-tools .hint { display: none; }
  .ed-grid { display: flex; margin: 0; }
  .ed-el { flex: none; flex-direction: row; padding: 8px 10px; }
  .ed-frame .player { grid-template-columns: 1fr; }
  .ed-frame .side { display: none; }
  .ed-canvas { padding: 10px; }
  .ed-frame .stage { padding: 20px 16px 40px; }
}

/* ---------- Full-screen app shell ---------- */
body.app-shell { height: 100vh; overflow: hidden; }
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
.rail { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rail-top { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.rail-course { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; padding: 12px 14px; background: #faf8f5; border-radius: 12px; }
.rail-course strong { font-family: var(--font-head); font-weight: 500; font-size: 1.02rem; line-height: 1.25; overflow-wrap: anywhere; }
.rail-course .badge { align-self: flex-start; }
.rail-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.rail-nav button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink-2); }
.rail-nav button:hover { background: #faf8f5; color: var(--ink); }
.rail-nav button.active { background: var(--pink-soft); color: var(--ink); }
.rail-num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #f1ede7; font-weight: 600; font-size: .85rem; }
.rail-nav button.active .rail-num { background: var(--pink); color: #212121; }
.rail-txt { display: flex; flex-direction: column; line-height: 1.25; }
.rail-txt span { font-weight: 500; }
.rail-txt small { font-size: .76rem; color: var(--ink-3); }
.rail-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; }
.rail-foot a { text-decoration: none; font-size: .88rem; color: var(--ink-2); padding: 7px 10px; border-radius: 8px; }
.rail-foot a:hover { background: #faf8f5; color: var(--ink); }
.work { overflow-y: auto; min-width: 0; background: var(--cream); }
.work-pad { padding: 32px 40px 80px; max-width: 1180px; }
.step-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.step-head h1 { margin: 0 0 4px; font-size: 2rem; }
.step-head p { margin: 0; }
.outline-side { top: 16px; }

/* ---------- Sales page live editor ---------- */
.work-full { overflow: hidden; }
.work-full #tabBody { height: 100%; }
.split { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; height: 100%; }
.split-form { overflow-y: auto; padding: 24px 20px 40px; border-right: 1px solid var(--line); }
.sf-head h1 { font-size: 1.6rem; margin: 0 0 4px; }
.sf-head p { margin: 0 0 16px; }
.sec-card { padding: 0; scroll-margin-top: 12px; }
.sec-card + .sec-card { margin-top: 10px; }
.sec-card summary { cursor: pointer; padding: 15px 18px; display: flex; gap: 12px; align-items: center; list-style: none; }
.sec-card summary::-webkit-details-marker { display: none; }
.sec-card summary::before { content: "▸"; color: var(--ink-3); transition: transform .15s; }
.sec-card[open] summary::before { transform: rotate(90deg); }
.sec-card.off { opacity: .7; }
.sec-body { padding: 0 18px 20px; }
.sec-card.flash { animation: flash 1.1s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--pink); } 100% { box-shadow: var(--shadow); } }
.split-preview { display: flex; flex-direction: column; min-width: 0; background: #ece8e2; }
.pv-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px #dff2e7; }
.seg { display: inline-flex; background: #f1ede7; border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font: 500 .82rem var(--font-body); cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.pv-stage { flex: 1; position: relative; overflow: hidden; min-height: 0; }
.pv-stage iframe { position: absolute; transform-origin: 0 0; border: 0; border-radius: 10px; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.15); }

@media (max-width: 900px) {
  body.app-shell { height: auto; overflow: auto; }
  .shell { grid-template-columns: 1fr; height: auto; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .rail-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
  .rail-course { margin: 0; padding: 6px 10px; flex: 1; }
  .rail-nav { flex-direction: row; overflow-x: auto; padding: 6px 8px; }
  .rail-nav button { flex: none; width: auto; padding: 8px 10px; }
  .rail-txt small { display: none; }
  .rail-foot { display: none; }
  .work, .work-full { overflow: visible; }
  .work-pad { padding: 20px 16px 60px; }
  .split { grid-template-columns: 1fr; height: auto; }
  .split-form { overflow: visible; border-right: 0; }
  .split-preview { display: none; }
}
.sf-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.only-sm { display: none; }
@media (max-width: 900px) { .only-sm { display: inline-flex; } }
.outline .module:first-of-type { margin-top: 0; }
.shell > *, .split > * { min-width: 0; }
@media (max-width: 900px) {
  .shell, .split { grid-template-columns: minmax(0, 1fr); }
  .rail-course { min-width: 0; }
  .rail-course strong, .rail-course span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sf-head p { display: none; }
  .split-form { padding: 16px; }
}

/* Sales page step: sidebar shrinks to step numbers so the preview gets the room */
@media (min-width: 901px) {
  .shell.rail-mini { grid-template-columns: 76px 1fr; }
  .rail-mini .rail-top { padding: 16px 0 12px; display: flex; justify-content: center; }
  .rail-mini .logo span:last-child, .rail-mini .rail-course, .rail-mini .rail-txt { display: none; }
  .rail-mini .rail-nav { padding: 12px 8px; align-items: center; }
  .rail-mini .rail-nav button { justify-content: center; padding: 10px 0; }
  .rail-mini .rail-foot a { font-size: 0; text-align: center; padding: 8px 0; }
  .rail-mini .rail-foot a::first-letter { font-size: 1rem; }
}

/* ---------- Builder typography: the device's own font, compact 13px base ---------- */
:root {
  --font-head: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-body: var(--font-head);
}
html { font-size: 13px; }
body { font-size: 1rem; line-height: 1.55; }
h1, h2, h3, h4, .logo, .rail-course strong { font-weight: 600; letter-spacing: -.01em; }
.step-head h1 { font-size: 1.85rem; }
/* The lesson editor shows the lesson at the size students see it (their pages use a 16px base). */
.ed-frame { zoom: 1.2308; }
/* Phones zoom in on inputs smaller than 16px, so keep inputs full size there. */
@media (max-width: 900px) { input[type=text], input[type=email], input[type=url], input[type=password], textarea, select { font-size: 16px; } }
