html, body { margin: 0; padding: 0; height: 100%; background: #f6f6f4; }
  body { overflow: hidden; }
  :root {
    color-scheme: light;
    --bg: #f6f6f4;
    --panel: #ffffff;
    --line: #e3e2de;
    --line2: #efeeea;
    --ink: #1f1e1c;
    --dim: #6b6a65;
    --brand: #2f6f9f;
    --brand-soft: #eaf2f8;
    --danger: #b4483c;
    --radius: 8px;
  }
  * { box-sizing: border-box; }
  .cvapp {
    font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* ---------- toolbar ---------- */
  .bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 9px 12px; background: var(--panel);
    border-bottom: 1px solid var(--line); flex: 0 0 auto;
  }
  .bar h1 { font-size: 13px; font-weight: 650; margin: 0 6px 0 0; letter-spacing: .01em; }
  .bar .sp { flex: 1; }
  .btn {
    font: inherit; font-weight: 550; cursor: pointer;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    padding: 6px 11px; border-radius: 6px;
  }
  .btn:hover { background: #faf9f7; border-color: #d3d2ce; }
  .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
  .btn.primary:hover { background: #28618c; }
  .chip {
    font-size: 11.5px; color: var(--dim); padding: 3px 8px;
    background: var(--bg); border: 1px solid var(--line2); border-radius: 20px;
  }
  .chip.warn { color: #8a5a12; background: #fdf6e6; border-color: #f0e0bd; display: none; align-items: center; }
  .zoomwrap { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11.5px; }
  .zoomwrap input { width: 90px; }

  /* ---------- ads ----------
     Fixed IAB sizes per breakpoint (Google's "exact size per screen width"
     pattern), so an ad never changes the layout height and is never clipped.
     Units inside a display:none slot are not requested (see the loader). */
  .mainrow { flex: 1; display: flex; min-height: 0; }
  .mainrow > .split { min-width: 0; }  /* else the form's min-content width overflows narrow screens */
  .adslot { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--panel); }
  .adslot-top { border-bottom: 1px solid var(--line); }
  .adslot-bottom { border-top: 1px solid var(--line); }
  .ad-banner { display: inline-block; width: 320px; height: 50px; }
  @media (min-width: 500px) { .ad-banner { width: 468px; height: 60px; } }
  @media (min-width: 800px) { .ad-banner { width: 728px; height: 90px; } }
  .adslot-side { display: none; width: 181px; border-left: 1px solid var(--line); align-items: flex-start; padding-top: 10px; }
  .ad-side { display: inline-block; width: 160px; height: 600px; }
  @media (min-width: 1400px) and (min-height: 880px) { .adslot-side { display: flex; } }

  /* ---------- site links in the toolbar ---------- */
  .barnav { display: flex; gap: 12px; margin: 0 6px; font-size: 12px; }
  .barnav a { color: var(--dim); text-decoration: none; }
  .barnav a:hover { color: var(--brand); text-decoration: underline; }
  .bar h1 a { color: inherit; text-decoration: none; }
  .noscript { padding: 40px 20px; text-align: center; font: 15px/1.5 system-ui, sans-serif; }

  /* ---------- split ---------- */
  .split { flex: 1; display: flex; min-height: 0; }
  #form {
    width: 400px; flex: 0 0 auto; min-width: 0;
    background: var(--panel);
    overflow-y: auto; padding: 10px 12px 60px;
  }
  #prev { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 20px; }

  /* ---------- splitter ---------- */
  .splitter {
    flex: 0 0 11px; position: relative; cursor: col-resize;
    background: var(--panel); border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    touch-action: none; user-select: none;
  }
  .splitter::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
    margin-left: -.5px; background: var(--line2);
  }
  .splitter:hover { background: var(--brand-soft); }
  .splitter:hover::before { background: var(--brand); }
  .splitter:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  body.splitting { cursor: col-resize; user-select: none; }
  body.splitting .splitter { background: var(--brand-soft); }
  body.splitting .splitter::before { background: var(--brand); }
  .sbtn {
    position: relative; z-index: 1; width: 15px; height: 19px; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
    font-size: 7px; color: var(--dim); background: var(--bg);
    border: 1px solid var(--line); cursor: pointer; margin-left: -2px;
  }
  .sbtn:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
  .sbtn.off { opacity: .25; pointer-events: none; }

  .split.hide-form > #form { display: none; }
  .split.hide-prev > #prev { display: none; }
  .split.hide-prev > #form { flex: 1 1 auto; width: auto !important; }
  #sheets { display: flex; flex-direction: column; align-items: center; gap: 30px; min-width: min-content; }

  /* ---------- form ---------- */
  .grp { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 9px; }
  .grp > summary {
    cursor: pointer; padding: 8px 10px; font-weight: 600; font-size: 12.5px;
    list-style: none; display: flex; align-items: center; gap: 6px;
  }
  .grp > summary::-webkit-details-marker { display: none; }
  .grp > summary::before { content: "\25B8"; color: var(--dim); font-size: 10px; }
  .grp[open] > summary::before { content: "\25BE"; }
  .grp > summary em { font-style: normal; font-size: 10.5px; color: var(--dim); background: var(--bg); padding: 1px 6px; border-radius: 10px; font-weight: 500; }
  .gb { padding: 2px 10px 11px; }
  .gb.flat { border: 0; padding: 0 0 12px; display: flex; gap: 6px; }
  .sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 12px 0 5px; font-weight: 600; }

  label { display: block; margin-bottom: 7px; font-size: 11px; color: var(--dim); font-weight: 550; }
  label.inline { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--ink); font-size: 12px; }
  label.inline input[type=color] { width: 30px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
  input, textarea, select {
    font: inherit; width: 100%; padding: 5px 7px; margin-top: 3px;
    border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink);
  }
  label.inline input, label.inline select { width: auto; margin: 0; }
  input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
  textarea { resize: vertical; line-height: 1.5; overflow: hidden; }
  select { padding: 4px 4px; }

  .row { display: flex; gap: 5px; align-items: center; margin-bottom: 5px; }
  .row > input, .row > select { margin-top: 0; }
  .row > select { flex: 0 0 74px; }
  .row.hd { margin-bottom: 8px; }
  .row.rt { justify-content: space-between; margin-bottom: 3px; }
  .rb { display: flex; gap: 2px; flex: 0 0 auto; }
  .ic {
    cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--dim);
    width: 22px; height: 24px; border-radius: 4px; font-size: 9px; line-height: 1; padding: 0;
  }
  .ic:hover { background: #f4f3f0; color: var(--ink); }
  .ic.del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
  .tag { flex: 1; font-size: 11px; color: var(--dim); }

  /* ---------- drag to reorder ---------- */
  .grip {
    flex: 0 0 auto; width: 14px; height: 22px; cursor: grab; border-radius: 3px;
    touch-action: none; align-self: center;
    background-image: radial-gradient(circle, var(--dim) 1px, transparent 1.2px);
    background-size: 5px 5px; background-position: 2px 5px;
    background-repeat: repeat; opacity: .42;
  }
  .grip:hover { opacity: .95; background-color: var(--bg); }
  .grip:active { cursor: grabbing; }
  summary .grip { display: inline-block; vertical-align: -6px; margin-right: 2px; }
  .card > .row.hd > .grip, .blk > .row > .grip { margin-right: 1px; }

  body.dragging { cursor: grabbing; user-select: none; }
  body.dragging .grip { cursor: grabbing; }
  [data-drag].dragsrc { opacity: .34; }
  .ghost {
    position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
    margin: 0; opacity: .95; max-height: 190px; overflow: hidden;
    background: #fff; border: 1px solid var(--brand); border-radius: 7px;
    box-shadow: 0 10px 28px rgba(0,0,0,.19); padding: 6px 8px;
    transform-origin: 0 0;
  }
  .ghost::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
  }
  .ghost .grip, .ghost .rb { opacity: .3; }
  .dropline {
    position: fixed; left: 0; top: 0; z-index: 61; height: 3px; border-radius: 2px;
    background: var(--brand); pointer-events: none;
    box-shadow: 0 0 0 1px rgba(255,255,255,.85);
  }
  .dropline::before {
    content: ""; position: absolute; left: -4px; top: -2.5px;
    width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  }
  @keyframes landpulse { from { background: #fff6d8; } to { background: transparent; } }
  [data-drag].landed { animation: landpulse 1.1s ease-out; border-radius: 6px; }

  .row.ach { align-items: flex-start; }
  .row.ach textarea { margin-top: 0; }
  .row.ach .rb { flex-direction: column; }
  .sub b { color: var(--brand); font-weight: 650; }
  .card { border: 1px solid var(--line2); border-radius: 7px; padding: 9px; margin-bottom: 8px; background: #fcfcfb; }
  .blk { border-left: 2px solid var(--line); padding-left: 8px; margin: 7px 0; }
  .add {
    font: inherit; font-size: 11.5px; font-weight: 550; cursor: pointer;
    border: 1px dashed var(--line); background: #fff; color: var(--brand);
    padding: 5px 9px; border-radius: 5px; width: 100%; margin-top: 3px;
  }
  .add:hover { background: var(--brand-soft); border-style: solid; }
  .add.sec { color: var(--dim); }
  .gb.flat .add { width: auto; }
  .pbtns { display: flex; flex-direction: column; gap: 5px; flex: 1; }
  .photorow { display: flex; gap: 9px; align-items: center; }
  .thumb { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: 0 0 auto; }
  .thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--dim); background: var(--bg); }

  /* ---------- theme swatches ---------- */
  .swgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; margin: 4px 0 9px; }
  .swb {
    position: relative; cursor: pointer; font: inherit; text-align: center;
    border: 1px solid var(--line); background: #fff; border-radius: 7px;
    padding: 8px 5px 7px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  }
  .swb:hover { border-color: #c2c1bd; background: #fcfcfb; }
  .swb.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); background: #fff; }
  .swb .sw { border: 1px solid var(--line2); border-radius: 2px; display: block; }
  .swn { font-size: 11.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
  .swn .mod {
    display: block; font-style: normal; font-size: 9.5px; font-weight: 500;
    color: #8a5a12; letter-spacing: .02em;
  }
  .swf { font-size: 9.5px; color: var(--dim); line-height: 1.2; }
  .swx {
    position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%;
    font-size: 8px; font-style: normal; line-height: 16px; color: var(--dim);
    background: var(--bg); border: 1px solid var(--line);
  }
  .swx:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
  .ic.ok:hover { color: #fff; background: var(--brand); border-color: var(--brand); }

  .rng { display: block; margin-bottom: 9px; }
  .rng > span { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); font-weight: 550; }
  .rng b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
  .rng input[type=range] { margin-top: 1px; }

  /* ---------- preview ---------- */
  .sheet {
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.10), 0 8px 24px rgba(0,0,0,.07);
    position: relative; flex: 0 0 auto; border-radius: 2px;
  }
  .sheet svg { display: block; border-radius: 2px; }
  .sheet .pnum {
    position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    font-size: 10.5px; color: var(--dim); padding-top: 5px;
  }
  .sheet svg text.tx { cursor: text; }
  .sheet svg text.tx:hover { fill: var(--brand) !important; }
  .sheet svg text.hot { paint-order: stroke; stroke: #ffe9a8; stroke-width: 3.2; stroke-linejoin: round; }

  /* ---------- overlays ---------- */
  .toast {
    position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 24px);
    background: #26251f; color: #fff; padding: 9px 15px; border-radius: 7px;
    font-size: 12.5px; max-width: 70ch; opacity: 0; pointer-events: none;
    transition: opacity .18s, transform .18s; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }
  .toast.bad { background: #8c2e24; }
  .busy, .drop {
    position: fixed; inset: 0; background: rgba(246,246,244,.86);
    display: none; align-items: center; justify-content: center; z-index: 50;
    font-size: 13px; font-weight: 550; color: var(--ink); flex-direction: column; gap: 10px;
  }
  .drop { background: rgba(47,111,159,.10); border: 3px dashed var(--brand); }
  .spinner {
    width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--brand);
    border-radius: 50%; animation: spin .8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

  /* stacked on narrow screens: a vertical divider has nothing to divide */
  @media (max-width: 820px) {
    .split { flex-direction: column; }
    #form { width: auto !important; flex: 0 0 auto; border-bottom: 1px solid var(--line); max-height: 52vh; }
    .splitter { display: none; }
    .split.hide-form > #form, .split.hide-prev > #prev { display: block; }
  }

/* placeholder boxes for `build.py --preview-ads`; no effect on a real build */
ins.adsbygoogle[data-ad-preview] {
  display: flex !important; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #e8eef5, #e8eef5 10px, #dde6f0 10px, #dde6f0 20px);
  border: 2px dashed #2f6f9f; box-sizing: border-box;
  color: #2f6f9f; font: 600 13px/1 system-ui, sans-serif; letter-spacing: .04em;
}
ins.adsbygoogle[data-ad-preview]::after { content: "AD: " attr(data-ad-preview); }
ins.adsbygoogle[data-ad-preview="content"] { min-height: 250px; }
