*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
:root{
  /* ── Storybook Sanctum Studio · Warm Parchment & Twilight Amethyst ── */
  --bg:#F4EBD8;        /* warm heirloom parchment */
  --surface:#FFFDF8;   /* sunlit linen card */
  --surface2:#EBE0C7;  /* aged vellum secondary surface */
  --border:#D4C5A6;    /* warm parchment border */
  --red:#6D28D9;       /* royal twilight amethyst primary action */
  --yellow:#E5C575;    /* burnished leaf gold highlight */
  --amber:#9A6E1C;     /* antique publisher gold */
  --teal:#3F684A;      /* woodland moss emerald */
  --text:#26211A;      /* deep iron-gall ink */
  --text2:#554A3C;     /* warm sepia body */
  --text3:#7E705D;     /* muted book-cloth label */
  --ink:#3B2C24;       /* etched chestnut leather border */
  --shadow:0 8px 24px rgba(38,33,26,.12);
  --r:14px;
  --r-sm:10px;
  --font-display:'Cormorant Garamond',Georgia,serif;
  --font-ui:'Plus Jakarta Sans',system-ui,-apple-system,sans-serif;
  /* Scene art (3:4 portrait) is cover-cropped into square/wide page cells.
     MUST stay in sync with SCENE_CROP_Y in js/12-export.js. */
  --scene-crop-y:28%;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bot:env(safe-area-inset-bottom,0px);
}
html,body{height:100%;overflow:hidden}
body{
  font-family:var(--font-ui);
  background:var(--bg);color:var(--text);
  display:flex;flex-direction:column;
  padding-top:var(--safe-top);
  user-select:none;-webkit-user-select:none;
}

/* ── SCREENS ── */
.screen{
  position:absolute;inset:0;padding-top:var(--safe-top);
  display:flex;flex-direction:column;
  opacity:0;pointer-events:none;
  transition:opacity .28s ease,transform .28s ease;
  transform:translateY(16px);
  overflow:hidden;
}
.screen.active{opacity:1;pointer-events:all;transform:none}

/* ── INSTALL BANNER ── */
#installBanner{
  display:none;
  background:linear-gradient(135deg,#FFFDF8,#EBE0C7);
  border-bottom:1px solid var(--border);
  padding:12px 16px;
  flex-direction:row;align-items:center;gap:12px;
  flex-shrink:0;
}
#installBanner.show{display:flex}
#installBanner .ib-icon{font-size:28px;flex-shrink:0}
#installBanner .ib-text{flex:1}
#installBanner .ib-title{font-size:13px;font-weight:700;color:var(--text)}
#installBanner .ib-sub{font-size:11px;color:var(--text2);margin-top:1px}
.ib-btn{
  background:var(--red);color:#fff;border:none;
  border-radius:8px;padding:8px 14px;
  font-family:var(--font-ui);font-size:12px;font-weight:700;
  cursor:pointer;flex-shrink:0;
}
.ib-dismiss{
  background:none;border:none;color:var(--text3);
  font-size:18px;cursor:pointer;padding:4px;flex-shrink:0;
}

/* ── SPLASH ── */
#splash{background:radial-gradient(640px 420px at 50% 28%,rgba(124,58,237,.22),transparent 68%),linear-gradient(180deg,#171C18 0%,#222820 58%,#1A1714 100%);color:#F4EBD8;align-items:center;justify-content:center;gap:0}
#splash .sp-sub{color:#DFD6C3;font-family:'Cormorant Garamond',Georgia,serif;font-style:italic;font-size:1.15rem;letter-spacing:.3px;margin-top:4px}
#splash .btn-p{background:linear-gradient(180deg,#E5C575,#C89B3C);color:#1A1610;border:1px solid rgba(255,244,214,.45);box-shadow:0 10px 28px rgba(200,155,60,.3)}
#splash .btn-g{border-color:rgba(244,235,216,.26);color:#E5DEC9;background:rgba(48,37,31,.45)}
#splash .sp-foot{color:#9E9686}
#splash .sp-auth{color:#A8A090}
#splash .sp-auth-link{color:#E5C575}
#splash .sp-auth-ok{color:#C6BFB0}
#splash .sp-auth-ok b{color:#F4EBD8}
.sp-bg{position:absolute;inset:0;overflow:hidden;pointer-events:none}
.sp-blob{position:absolute;border-radius:50%;filter:blur(75px);opacity:.26}
.sp-blob:nth-child(1){width:320px;height:320px;background:#7C3AED;top:-100px;left:-100px;animation:bl1 7s ease-in-out infinite}
.sp-blob:nth-child(2){width:280px;height:280px;background:#C89B3C;bottom:-80px;right:-80px;animation:bl2 8s ease-in-out infinite}
.sp-blob:nth-child(3){width:220px;height:220px;background:#593A2E;top:35%;left:20%;animation:bl1 9s ease-in-out infinite reverse}
@keyframes bl1{0%,100%{transform:translate(0,0) scale(1)}50%{transform:translate(24px,-24px) scale(1.08)}}
@keyframes bl2{0%,100%{transform:translate(0,0) scale(1)}50%{transform:translate(-18px,18px) scale(1.06)}}
.sp-logo{
  position:relative;z-index:1;text-align:center;
  animation:popIn .55s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes popIn{from{opacity:0;transform:scale(.65)}to{opacity:1;transform:scale(1)}}
.sp-icon{display:none}
.sp-h1{
  font-family:var(--font-display);font-weight:700;
  font-size:3.4rem;letter-spacing:0;
  color:var(--text);line-height:.95;margin-bottom:10px;
}
.sp-sub{font-size:13px;color:var(--text2);letter-spacing:.6px}
.sp-cta{
  position:relative;z-index:1;
  width:100%;max-width:320px;padding:0 24px;margin-top:52px;
  animation:slideUp .5s .35s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes slideUp{from{opacity:0;transform:translateY(28px)}to{opacity:1;transform:translateY(0)}}
.sp-foot{
  position:relative;z-index:1;
  margin-top:28px;font-size:11px;color:var(--text3);
  text-align:center;letter-spacing:.3px;
  animation:slideUp .4s .55s both;
}
/* sign-in / sign-up row under the splash CTAs (swaps to an account line
   once signed in — see updateAccountUI) */
.sp-auth{
  margin-top:18px;
  display:flex;align-items:center;justify-content:center;gap:8px;
  font-size:12px;color:var(--text3);
}
.sp-auth-link{
  background:none;border:none;padding:4px 2px;cursor:pointer;
  font-family:var(--font-ui);font-size:12px;font-weight:700;
  color:var(--teal);letter-spacing:.3px;
}
.sp-auth-link:active{opacity:.7}
.sp-auth-sep{color:var(--text3)}
.sp-auth-ok{
  font-size:11.5px;color:var(--text3);letter-spacing:.3px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:270px;
}
.sp-auth-ok b{color:var(--text2);font-weight:700}

/* ── DISCLAIMER / TOS ── */
#disclaimer{background:var(--bg);align-items:stretch;justify-content:flex-start;overflow:hidden}
.disc-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:calc(20px + var(--safe-top)) 22px 16px}
.disc-scroll::-webkit-scrollbar{display:none}
.disc-badge{display:inline-block;background:rgba(109,40,217,.1);border:1px solid rgba(109,40,217,.28);color:var(--red);font-size:9px;font-weight:700;letter-spacing:2px;text-transform:uppercase;padding:4px 12px;border-radius:20px;margin-bottom:14px}
.disc-section{margin-bottom:22px}
.disc-h{font-family:var(--font-display);font-weight:700;font-size:1.3rem;letter-spacing:2px;color:var(--text);margin-bottom:10px;display:flex;align-items:center;gap:8px}
.disc-body{font-size:12.5px;color:var(--text2);line-height:1.75}
.disc-body b{color:var(--text);font-weight:700}
.disc-body ul{padding-left:18px;margin-top:6px}
.disc-body ul li{margin-bottom:5px}
.disc-divider{height:1px;background:var(--border);margin:20px 0}
.disc-tos-box{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:16px;max-height:180px;overflow-y:auto;margin-bottom:6px;font-size:11px;color:var(--text2);line-height:1.7}
.disc-tos-box::-webkit-scrollbar{width:4px}
.disc-tos-box::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}
.disc-tos-lbl{font-size:9px;font-weight:700;color:var(--text3);letter-spacing:1.5px;text-transform:uppercase;margin:14px 0 6px}
.disc-tos-box b{color:var(--text);font-weight:700}
.disc-cta{flex-shrink:0;padding:14px 22px calc(14px + var(--safe-bot));border-top:1px solid var(--border);background:var(--bg)}
.disc-agree{width:100%;padding:16px;background:var(--red);border:1.5px solid rgba(59,44,36,.35);border-radius:var(--r);font-family:var(--font-ui);font-size:15px;font-weight:700;color:#fff;letter-spacing:.4px;cursor:pointer;box-shadow:var(--shadow);transition:transform .12s,box-shadow .12s}
.disc-agree:active{transform:translate(3px,3px);box-shadow:2px 2px 0 var(--ink)}
.disc-decline{width:100%;padding:13px;margin-top:10px;background:transparent;border:1.5px solid var(--border);border-radius:var(--r);font-family:var(--font-ui);font-size:13px;font-weight:600;color:var(--text2);cursor:pointer}

/* ── BUTTONS ── */
.btn-p{
  width:100%;padding:16px;
  background:var(--red);
  border:1.5px solid rgba(59,44,36,.35);border-radius:var(--r);
  font-family:var(--font-ui);font-size:15px;font-weight:700;
  color:#fff;letter-spacing:.4px;cursor:pointer;
  box-shadow:var(--shadow);
  position:relative;overflow:hidden;
  transition:transform .12s,box-shadow .12s;
}
.btn-p::after{content:'';position:absolute;inset:0;background:linear-gradient(rgba(255,255,255,.14),transparent)}
.btn-p:active{transform:translate(3px,3px);box-shadow:2px 2px 0 var(--ink)}
.btn-p:disabled{opacity:.4;pointer-events:none;box-shadow:2px 2px 0 var(--ink)}
.btn-g{
  width:100%;padding:15px;margin-top:10px;
  background:transparent;border:1.5px solid var(--border);
  border-radius:var(--r);
  font-family:var(--font-ui);font-size:14px;font-weight:600;
  color:var(--text2);cursor:pointer;
  transition:border-color .15s,color .15s;
}
.btn-g:active{border-color:var(--text2);color:var(--text)}

/* ── TOPBAR ── */
.topbar{
  flex-shrink:0;display:flex;align-items:center;
  padding:10px 18px 0;gap:10px;min-height:54px;
}
.tb-title{
  font-family:var(--font-display);font-weight:700;
  font-size:1.55rem;letter-spacing:.4px;color:var(--text);flex:1;
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.ic-btn{
  width:38px;height:38px;
  background:var(--surface);border:1.5px solid var(--border);
  border-radius:9px;display:flex;align-items:center;justify-content:center;
  font-size:17px;cursor:pointer;flex-shrink:0;
  transition:background .12s,transform .1s;
}
.ic-btn:active{background:var(--surface2);transform:translateY(1px)}
@media(max-width:400px){
  .topbar{gap:6px;padding:10px 12px 0}
  .ic-btn{width:34px;height:34px;font-size:15px}
}
@media(max-width:340px){
  .topbar{gap:5px;padding:10px 10px 0}
  .ic-btn{width:32px;height:32px;font-size:14px}
}

/* ── VIEWER ACTION BAR ──
   The four primary viewer actions as prominent, labeled text buttons instead
   of easy-to-miss single-glyph icons. Sits directly under the topbar. */
.viewer-actions{
  flex-shrink:0;display:flex;align-items:stretch;gap:8px;
  padding:8px 14px 10px;
}
.va-btn{
  flex:1;min-width:0;
  display:flex;align-items:center;justify-content:center;gap:6px;
  padding:11px 8px;
  background:var(--surface);border:1.5px solid var(--border);border-radius:11px;
  color:var(--text);cursor:pointer;
  font-family:var(--font-ui);font-size:13px;font-weight:800;letter-spacing:.2px;
  transition:background .12s,border-color .12s,transform .06s;
}
.va-btn:active{transform:translateY(1px);background:var(--surface2)}
.va-btn .va-ic{font-size:16px;line-height:1}
.va-primary{
  background:var(--red);border-color:var(--ink);color:#fff;
}
.va-primary:active{background:var(--red)}
/* Edit-mode "on" state — reuses the existing toggle class from toggleEditMode(). */
.va-btn.edit-btn-active{background:var(--yellow) !important;color:#111 !important;border-color:var(--yellow) !important;}
@media(max-width:400px){
  .viewer-actions{gap:6px;padding:8px 12px 10px}
  .va-btn{font-size:12px;padding:10px 6px;gap:5px}
  .va-btn .va-ic{font-size:15px}
}
@media(max-width:340px){
  .va-btn .va-lbl{font-size:11px}
}

/* ── SCROLL ── */
.scroll{
  flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding-bottom:calc(76px + var(--safe-bot));
}
.scroll::-webkit-scrollbar{display:none}

/* ── BOTTOM NAV ── */
.bnav{
  position:fixed;bottom:0;left:0;right:0;
  padding:8px 12px calc(8px + var(--safe-bot));
  background:linear-gradient(transparent,rgba(244,235,216,.98) 32%);
  display:flex;justify-content:space-around;z-index:50;
}
.ni{
  display:flex;flex-direction:column;align-items:center;
  gap:3px;cursor:pointer;padding:7px 16px;
  border-radius:11px;transition:background .12s;min-width:56px;
}
.ni:active{background:var(--surface2)}
.ni-icon{font-size:21px;line-height:1}
.ni-lbl{font-size:9px;font-weight:700;color:var(--text3);letter-spacing:.4px}
.ni.on .ni-lbl{color:var(--red)}

/* ── FORM ELEMENTS ── */
.pad{padding:0 18px}
.slbl{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1.6px;text-transform:uppercase;margin-bottom:9px;margin-top:18px;display:block}
.card{background:var(--surface);border:1.5px solid var(--border);border-radius:var(--r);padding:15px;margin-bottom:10px;box-shadow:0 6px 20px rgba(38,33,26,.06)}
.frow{display:flex;align-items:center;gap:10px;padding:3px 0}
.frow+.frow{border-top:1px solid var(--border);padding-top:10px;margin-top:6px}
.ficon{font-size:19px;width:28px;text-align:center;flex-shrink:0}
.finfo{flex:1}
.fname{font-size:12px;font-weight:700;color:var(--text)}
.fhint{font-size:10px;color:var(--text3);margin-top:1px}
.finput{
  width:100%;margin-top:8px;padding:11px 13px;
  background:var(--surface2);border:1.5px solid var(--border);
  border-radius:var(--r-sm);
  font-family:var(--font-ui);font-size:12px;color:var(--text);
  outline:none;transition:border-color .15s;-webkit-appearance:none;
  font-family:monospace;
}
.finput:focus{border-color:var(--red)}
.finput::placeholder{color:var(--text3)}
.tinput{
  width:100%;padding:13px 14px;
  background:var(--surface2);border:1.5px solid var(--border);
  border-radius:var(--r-sm);
  font-family:var(--font-ui);font-size:13px;color:var(--text);
  outline:none;transition:border-color .15s;-webkit-appearance:none;
}
.tinput:focus{border-color:var(--red)}
.tinput::placeholder{color:var(--text3)}
textarea.tinput{resize:none;line-height:1.55}

/* ── CHARACTERS ── */
.cast-list{display:flex;flex-direction:column;gap:10px;margin-bottom:10px}
.char-card{background:var(--surface2);border:1.5px solid var(--border);border-radius:var(--r-sm);padding:12px;display:flex;align-items:center;gap:12px;position:relative;}
.char-card.has-photo{border-color:var(--teal)}
.char-thumb{width:56px;height:56px;border-radius:10px;flex-shrink:0;background:var(--surface);border:1.5px solid var(--border);display:flex;align-items:center;justify-content:center;font-size:22px;cursor:pointer;overflow:hidden;}
.char-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.char-fields{flex:1;display:flex;flex-direction:column;gap:6px;min-width:0}
.char-name-input,.char-role-input{width:100%;padding:7px 10px;background:var(--surface);border:1.5px solid var(--border);border-radius:7px;font-family:var(--font-ui);font-size:12px;color:var(--text);outline:none;-webkit-appearance:none;}
.char-name-input:focus,.char-role-input:focus{border-color:var(--teal)}
.char-name-input::placeholder,.char-role-input::placeholder{color:var(--text3)}
.char-photo-btns{display:flex;gap:5px}
.char-photo-btn{flex:1;padding:5px;border-radius:6px;background:var(--surface);border:1px solid var(--border);font-size:10px;font-weight:700;color:var(--text2);cursor:pointer;text-align:center;font-family:var(--font-ui);}
.char-photo-btn:active{background:var(--surface2)}
.char-del{position:absolute;top:8px;right:8px;width:22px;height:22px;border-radius:50%;background:rgba(109,40,217,.1);border:1px solid rgba(109,40,217,.22);color:var(--red);font-size:13px;display:flex;align-items:center;justify-content:center;cursor:pointer;}
.char-status{font-size:10px;color:var(--teal);font-weight:700;margin-top:2px}
.add-char-btn{width:100%;padding:12px;background:transparent;border:1.5px dashed var(--border);border-radius:var(--r-sm);font-family:var(--font-ui);font-size:13px;font-weight:700;color:var(--text3);cursor:pointer;transition:border-color .15s,color .15s;}
.add-char-btn:active{border-color:var(--teal);color:var(--teal)}
.reuse-char-btn{margin-top:8px}
.cast-info{font-size:10px;color:var(--text3);text-align:center;margin-top:4px;line-height:1.5}

/* ── Character bank (Library screen) ── */
.cb-head{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1px;text-transform:uppercase;padding:0 18px;margin:14px 0 8px}
.cb-head-sub{font-weight:600;text-transform:none;letter-spacing:0}
.cb-strip{display:flex;gap:10px;overflow-x:auto;padding:8px 18px 10px;scrollbar-width:none}
.cb-strip::-webkit-scrollbar{display:none}
.cb-card{position:relative;flex-shrink:0;width:86px;background:var(--surface);border:1.5px solid var(--border);border-radius:var(--r-sm);padding:8px;text-align:center}
.cb-card img{width:62px;height:62px;border-radius:10px;object-fit:cover;background:var(--surface2);border:1px solid var(--border)}
.cb-name{font-size:11px;font-weight:700;color:var(--text);margin-top:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}
.cb-src{font-size:9px;color:var(--text3);margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cb-del{position:absolute;top:-6px;right:-6px;width:20px;height:20px;border-radius:50%;background:#ffe3e8;border:1px solid rgba(109,40,217,.22);color:var(--red);font-size:11px;display:flex;align-items:center;justify-content:center;cursor:pointer}

/* ── Reuse-a-character picker ── */
.reuse-grid{display:flex;flex-direction:column;gap:8px;max-height:50vh;overflow-y:auto;margin-bottom:14px}
.reuse-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px;background:var(--surface2);border:1.5px solid var(--border);border-radius:var(--r-sm);cursor:pointer;text-align:left;font-family:var(--font-ui)}
.reuse-item:active{border-color:var(--teal)}
.reuse-item img{width:52px;height:52px;border-radius:10px;object-fit:cover;flex-shrink:0;background:var(--surface);border:1px solid var(--border)}
.reuse-item-name{font-size:13px;font-weight:700;color:var(--text)}
.reuse-item-src{font-size:11px;color:var(--text3);margin-top:2px}
.reuse-empty{font-size:12px;color:var(--text2);line-height:1.6;padding:4px 0 10px}

/* ── Series / sequel ── */
.series-banner{display:flex;align-items:center;justify-content:space-between;gap:10px;background:rgba(63,104,74,.09);border:1px solid rgba(63,104,74,.25);border-radius:var(--r-sm);padding:10px 12px;margin-bottom:12px;font-size:12px;color:var(--text2)}
.series-banner b{color:var(--teal)}
.series-banner-x{flex-shrink:0;width:22px;height:22px;border-radius:50%;background:transparent;border:1px solid var(--border);color:var(--text3);font-size:11px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.sequel-ph{width:52px;height:70px;border-radius:8px;background:var(--surface);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0}
#sequelGrid .reuse-item img{height:70px;border-radius:8px} /* book covers are portrait */
.lt-badge{position:absolute;top:6px;left:6px;z-index:2;background:var(--teal);color:#fff;font-size:9px;font-weight:800;letter-spacing:.5px;padding:3px 7px;border-radius:99px}

/* ── STYLE CHIPS ── */
.fmt-scroll{display:flex;gap:10px;overflow-x:auto;padding:2px 18px;margin:0 -18px;scrollbar-width:none}
.fmt-scroll::-webkit-scrollbar{display:none}
.fmt-card{
  flex-shrink:0;width:130px;
  background:var(--surface);border:1.5px solid var(--border);
  border-radius:var(--r-sm);padding:12px 10px;cursor:pointer;
  transition:all .18s;
}
.fmt-card.on{border-color:var(--amber);background:rgba(255,224,75,.12);box-shadow:0 0 16px rgba(212,136,6,.12)}
.fmt-card .fe{font-size:24px;display:block;margin-bottom:5px}
.fmt-card .fn{font-size:11px;font-weight:700;color:var(--text2);margin-bottom:2px}
.fmt-card .fd{font-size:9px;color:var(--text3);line-height:1.4}
.fmt-card.on .fn{color:var(--amber)}
/* ── ART-STYLE DROPDOWN ── */
.style-select-wrap{position:relative}
.style-select-wrap::after{
  content:'';position:absolute;right:15px;top:50%;width:9px;height:9px;
  margin-top:-6px;pointer-events:none;
  border-right:2px solid var(--text3);border-bottom:2px solid var(--text3);
  transform:rotate(45deg);
}
.style-select{
  -webkit-appearance:none;-moz-appearance:none;appearance:none;
  width:100%;background:var(--surface);border:1.5px solid var(--border);
  border-radius:var(--r-sm);padding:13px 38px 13px 14px;
  font-family:var(--font-ui);font-size:14px;font-weight:700;color:var(--text);
  cursor:pointer;transition:border-color .18s,box-shadow .18s;
}
.style-select:hover{border-color:var(--text3)}
.style-select:focus{outline:none;border-color:var(--red);box-shadow:0 0 18px rgba(109,40,217,.1)}
.style-select option{background:var(--surface);color:var(--text);font-weight:600}
.style-select optgroup{background:var(--bg);color:var(--text3);font-style:normal;font-weight:700}

/* ── STRUCT TILES ── */
.stgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:4px}
.stile{
  background:var(--surface2);border:1.5px solid var(--border);
  border-radius:var(--r-sm);padding:11px 5px;text-align:center;cursor:pointer;
  transition:all .18s;
}
.stile.on{border-color:var(--teal);background:rgba(63,104,74,.08)}
.stile .stn{font-family:var(--font-display);font-weight:700;font-size:1.7rem;letter-spacing:1px;color:var(--text2);display:block}
.stile.on .stn{color:var(--teal)}
.stile .sts{font-size:9px;font-weight:700;color:var(--text3)}

/* ── COST ── */
.cost-row{text-align:center;font-size:11px;color:var(--text3);margin:16px 0 12px}
.cost-row b{color:var(--amber)}

/* ── PROGRESS SCREEN ── */
#prog-screen{background:var(--bg);align-items:center;justify-content:center;text-align:center;padding:32px}
.prog-ring{
  width:130px;height:130px;position:relative;margin-bottom:28px;
}
.prog-ring svg{position:absolute;inset:0;width:100%;height:100%;transform:rotate(-90deg)}
.prog-ring .track{fill:none;stroke:var(--surface2);stroke-width:5}
.prog-ring .fill{
  fill:none;stroke:var(--red);stroke-width:5;stroke-linecap:round;
  stroke-dasharray:345;stroke-dashoffset:345;
  transition:stroke-dashoffset .5s ease;
}
.prog-ring .center{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:50px}
.prog-h{font-family:var(--font-display);font-weight:700;font-size:1.9rem;letter-spacing:2px;color:var(--text);margin-bottom:10px;line-height:1.1}
.prog-msg{font-size:13px;color:var(--text2);line-height:1.65;min-height:42px;max-width:280px}
.prog-track{width:240px;height:3px;background:var(--surface2);border-radius:2px;margin:20px auto 8px;overflow:hidden}
.prog-fill{height:100%;background:linear-gradient(90deg,var(--red),var(--yellow));border-radius:2px;transition:width .45s ease;width:0%}
.prog-pct{font-size:10px;color:var(--text3);letter-spacing:.4px}

/* ── LIVE PAGE PREVIEW on the progress screen ── */
#progPreview{width:100%;max-width:340px;margin-top:18px}
.pp-label{font-size:11px;font-weight:700;color:var(--text2);letter-spacing:1px;text-transform:uppercase;margin-bottom:8px}
.pp-strip{display:flex;gap:8px;overflow-x:auto;-webkit-overflow-scrolling:touch;padding:2px 2px 6px;scroll-behavior:smooth}
.pp-thumb{flex:0 0 auto;width:74px;height:74px;border-radius:8px;overflow:hidden;border:1.5px solid var(--border);background:var(--surface2);cursor:pointer;animation:ppIn .4s ease}
.pp-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.pp-count{font-size:10px;color:var(--text3);margin-top:6px}
@keyframes ppIn{from{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}
/* Full-screen peek on tap */
.pp-peek{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.85);display:flex;align-items:center;justify-content:center;padding:24px;cursor:zoom-out}
.pp-peek img{max-width:100%;max-height:100%;border-radius:10px;box-shadow:0 20px 60px rgba(0,0,0,.6)}

/* ── BOOK VIEWER ── */
#viewer-screen .topbar{position:absolute;top:0;left:0;right:0;z-index:10;background:linear-gradient(var(--bg),transparent);padding-top:calc(10px + var(--safe-top))}
.book-pages{padding:14px;display:flex;flex-direction:column;gap:16px}
.pg{background:#fff;border:1px solid var(--border);border-radius:11px;overflow:hidden;box-shadow:0 10px 34px rgba(26,26,46,.14)}
/* cover */
.pg-cover{position:relative}
.pg-cover img,.pg-cover .ph{width:100%;aspect-ratio:2/3;object-fit:cover;object-position:center var(--scene-crop-y);display:block}
.pg-cover .ph{background:var(--surface);display:flex;align-items:center;justify-content:center;font-size:40px}
.cov-overlay{position:absolute;top:0;left:0;right:0;padding:20px 18px 32px;background:linear-gradient(rgba(0,0,0,.96) 30%,transparent);pointer-events:none}
.cov-title{font-family:'Bangers',cursive;font-size:2.2rem;letter-spacing:4px;color:#fff;line-height:1.1;
  text-shadow:2px 2px 0 rgba(255,61,90,.8),0 0 20px rgba(109,40,217,.32);word-break:break-word}
.cov-tagline{font-size:11px;color:rgba(255,255,255,.55);margin-top:4px;font-style:italic}
.cov-badge{position:absolute;top:12px;left:12px;background:var(--red);border-radius:20px;padding:3px 11px;font-family:'Bangers',cursive;font-size:.85rem;letter-spacing:1px;color:#fff;border:1.5px solid rgba(255,255,255,.25)}
/* splash */
.pg-splash{position:relative}
.pg-splash img,.pg-splash .ph{width:100%;aspect-ratio:16/9;object-fit:cover;object-position:center var(--scene-crop-y);display:block}
.pg-splash .ph{background:var(--surface);display:flex;align-items:center;justify-content:center;font-size:32px}
.spl-overlay{position:absolute;inset:0;background:linear-gradient(to top,rgba(0,0,0,.9) 40%,transparent);display:flex;flex-direction:column;justify-content:flex-end;padding:16px;pointer-events:none}
.spl-num{font-size:9px;font-weight:700;color:var(--yellow);letter-spacing:2.5px;margin-bottom:3px}
.spl-title{font-family:'Bangers',cursive;font-size:1.5rem;letter-spacing:2px;color:#fff;line-height:1}
/* interior */
.pg-hdr{background:#111;padding:5px 13px;display:flex;justify-content:space-between;border-bottom:2px solid var(--red)}
.pg-hdr span{font-size:8px;font-weight:700;color:#666;letter-spacing:1px}
.panelgrid{display:grid;gap:2px;background:#1a1a1a;padding:2px}
.panelgrid.g2{grid-template-columns:1fr 1fr}
.panelgrid.g3{grid-template-columns:1fr 1fr 1fr}
.panelgrid.g4{grid-template-columns:1fr 1fr;grid-template-rows:auto auto}
.panelgrid.g6{grid-template-columns:1fr 1fr 1fr;grid-template-rows:auto auto}
.pcell{background:#111;display:flex;flex-direction:column}
.pcell img{width:100%;aspect-ratio:1;object-fit:cover;object-position:center var(--scene-crop-y);display:block}
.pcell .pph{aspect-ratio:1;background:#0d0d0d;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px}
.pcell .pph .ms{width:16px;height:16px;border:2px solid #333;border-top-color:var(--red);border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.pcell .pph p{font-size:8px;color:#444;font-weight:700}
.pcap{display:block;background:#fff;color:#111;font-weight:700;font-family:Arial,sans-serif;font-size:11px;text-align:center;line-height:1.35;padding:8px 10px;border-top:3px solid #111}
/* back */
.pg-back{background:var(--surface);padding:28px 20px;text-align:center}
.pg-back img{width:72px;height:72px;border-radius:50%;object-fit:cover;border:3px solid var(--yellow);margin:0 auto 14px;display:block}
.pg-back h2{font-family:'Bangers',cursive;font-size:1.7rem;letter-spacing:2px;color:var(--amber);margin-bottom:8px}
.pg-back p{font-size:12px;color:var(--text2);line-height:1.7;margin-bottom:16px}
.pg-back .bc{font-family:monospace;font-size:9px;color:var(--text3);letter-spacing:2px}

.proxy-mode #apiKeysBlock { display:none !important; }

/* ── STORY PREVIEW ── */
#story-preview{background:var(--bg)}
.sp-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding-bottom:calc(100px + var(--safe-bot))}
.sp-scroll::-webkit-scrollbar{display:none}
.sp-section{margin:0 18px 20px}
.sp-label{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1.5px;text-transform:uppercase;margin-bottom:8px}
.sp-title-block{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);padding:14px}
.sp-book-title{font-family:var(--font-display);font-weight:700;font-size:1.6rem;letter-spacing:2px;color:var(--amber);line-height:1}
.sp-tagline{font-size:12px;color:var(--text2);margin-top:4px;font-style:italic}
.sp-synopsis{font-size:13px;color:var(--text2);line-height:1.7;margin-top:8px;padding-top:8px;border-top:1px solid var(--border)}
.sp-chapter{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);margin-bottom:10px;overflow:hidden}
.sp-ch-header{background:var(--surface2);padding:10px 14px;display:flex;align-items:center;justify-content:space-between;cursor:pointer}
.sp-ch-num{font-size:9px;font-weight:700;color:var(--red);letter-spacing:2px}
.sp-ch-title{font-family:var(--font-display);font-weight:700;font-size:1rem;letter-spacing:1px;color:var(--text)}
.sp-ch-toggle{font-size:14px;color:var(--text3);transition:transform .2s}
.sp-ch-toggle.open{transform:rotate(180deg)}
.sp-panels{display:none;padding:10px 14px;border-top:1px solid var(--border)}
.sp-panels.show{display:block}
.sp-panel{display:flex;gap:10px;padding:8px 0;border-bottom:0.5px solid var(--border)}
.sp-panel:last-child{border-bottom:none}
.sp-panel-num{font-size:9px;font-weight:700;color:var(--text3);min-width:20px;padding-top:2px}
.sp-panel-body{flex:1}
.sp-panel-scene{font-size:11px;color:var(--text2);line-height:1.5;margin-bottom:4px}
.sp-panel-caption{font-size:12px;font-weight:700;color:var(--text);font-style:italic}
.sp-panel-reroll{margin-top:6px;font-size:10px;font-weight:700;color:var(--teal);background:rgba(63,104,74,.09);border:1px solid var(--border);border-radius:99px;padding:4px 10px;cursor:pointer}
.sp-panel-reroll:active{background:rgba(63,104,74,.18)}
.sp-panel-reroll:disabled{opacity:.55;cursor:default}
.sp-panel.rerolling .sp-panel-scene,.sp-panel.rerolling .sp-panel-caption{opacity:.4}
.sp-bottom-bar{position:fixed;bottom:0;left:0;right:0;padding:12px 18px calc(12px + var(--safe-bot));background:linear-gradient(transparent,rgba(244,235,216,.98) 30%)}
.sp-retry-note{font-size:11px;color:var(--text3);text-align:center;margin-bottom:8px}
.sp-btn-row{display:flex;gap:10px}

/* ── OPENING PREVIEW ──
   The free first pages shown before the paywall. The PAGES themselves are
   rendered by the viewer's own markup (.fc-page / .cb-page and friends), on
   purpose — what a customer is shown before paying has to look like the book
   they'd get. Only the chrome around them is styled here. */
#opening-preview{background:var(--bg)}
.op-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:0 18px calc(110px + var(--safe-bot))}
.op-scroll::-webkit-scrollbar{display:none}
.op-intro{padding:12px 0 16px}
.op-book-title{font-family:var(--font-display);font-weight:700;font-size:1.6rem;letter-spacing:2px;color:var(--amber);line-height:1.1}
.op-tagline{font-size:12px;color:var(--text2);margin-top:4px;font-style:italic}
.op-note{font-size:12px;color:var(--text2);line-height:1.6;margin-top:10px;padding:10px 12px;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm)}
.op-page-wrap{margin-bottom:6px}
.op-page-num{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1.5px;text-transform:uppercase;margin-bottom:6px}
/* The preview borrows the viewer's page markup, which carries the per-panel
   editing controls (⛶ fullscreen editor, ↺ AI redraw). Those act on the OPEN
   book — there isn't one here — so hide them: these pages are a read-only look
   at what the book will be, and editing starts after it's bought. */
#opening-preview .panel-expand-btn,
#opening-preview .redraw-btn{display:none!important}
.op-bottom-bar{position:fixed;bottom:0;left:0;right:0;padding:12px 18px calc(12px + var(--safe-bot));
  background:linear-gradient(transparent,rgba(244,235,216,.98) 30%)}
.op-bottom-note{font-size:11px;color:var(--text3);text-align:center;margin-bottom:8px}

/* ── DOWNLOAD SHEET ── */
#dlSheet{
  display:none;position:fixed;inset:0;z-index:9998;
  background:rgba(26,26,46,.45);align-items:flex-end;
}
#dlSheet.show{display:flex}
.dl-panel{
  background:var(--surface);border-radius:var(--r) var(--r) 0 0;
  border-top:1px solid var(--border);
  width:100%;padding:16px 16px calc(16px + var(--safe-bot));
  max-height:85vh;overflow-y:auto;
}
.dl-title{font-size:11px;font-weight:700;color:var(--text3);letter-spacing:1px;text-transform:uppercase;margin-bottom:12px;text-align:center}
.dl-section-label{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1.2px;text-transform:uppercase;margin:14px 4px 8px;opacity:.7}
.dl-section-label:first-of-type{margin-top:0}
.dl-option{
  display:flex;align-items:center;gap:14px;
  padding:14px 16px;border-radius:var(--r-sm);
  cursor:pointer;transition:background .15s;margin-bottom:6px;
  background:var(--surface2);border:1px solid var(--border);
}
.dl-option:active{background:var(--border)}
.dl-icon{font-size:24px;width:32px;text-align:center;flex-shrink:0}
.dl-info{flex:1}
.dl-name{font-size:14px;font-weight:700;color:var(--text)}
.dl-desc{font-size:11px;color:var(--text3);margin-top:2px}
.dl-cancel{width:100%;padding:14px;margin-top:4px;background:transparent;border:1px solid var(--border);border-radius:var(--r-sm);font-family:var(--font-ui);font-size:14px;font-weight:600;color:var(--text2);cursor:pointer}

/* ── Title editor sheet ── */
#titleSheet{display:none;position:fixed;inset:0;z-index:9999;background:rgba(26,26,46,.45);align-items:flex-end}
#titleSheet.show{display:flex}
.ttx-panel{background:var(--surface);border-radius:var(--r) var(--r) 0 0;border-top:1px solid var(--border);width:100%;max-width:560px;margin:0 auto;padding:14px 16px calc(16px + var(--safe-bot));max-height:88vh;overflow-y:auto}
.ttx-row{display:flex;align-items:center;flex-wrap:wrap;gap:7px;margin-bottom:12px}
.ttx-label{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1px;text-transform:uppercase;width:100%;margin-bottom:-3px}
.ttx-input{flex:1;min-width:120px;background:var(--surface2);border:1px solid var(--border);border-radius:var(--r-sm);padding:9px 11px;color:var(--text);font-family:var(--font-ui);font-size:14px}
.ttx-opt{padding:7px 11px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface2);color:var(--text2);font-family:var(--font-ui);font-size:12px;font-weight:700;cursor:pointer}
.ttx-opt.on{border-color:var(--red);color:var(--text);background:rgba(109,40,217,.1)}
.ttx-sw{width:26px;height:26px;border-radius:50%;border:2px solid var(--border);cursor:pointer;padding:0;flex-shrink:0}
.ttx-sw.on{border-color:#fff;box-shadow:0 0 0 2px var(--red)}
.ttx-sw.ttx-none{background:var(--surface2);color:var(--text3);font-size:13px;line-height:1}
.ttx-range{flex:1;min-width:120px;accent-color:var(--red)}
.ttx-done{width:100%;padding:13px;margin-top:4px;background:var(--red);border:none;border-radius:var(--r-sm);font-family:var(--font-ui);font-size:14px;font-weight:700;color:#fff;cursor:pointer}

/* ── Lulu print-order modal ── */
#luluModal,#matterModal{display:none;position:fixed;inset:0;z-index:9999;background:rgba(26,26,46,.45);align-items:center;justify-content:center;padding:16px}
#luluModal.show,#matterModal.show{display:flex}
.lulu-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);width:100%;max-width:520px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}
.lulu-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--border);flex-shrink:0}
.lulu-x{background:transparent;border:none;color:var(--text2);font-size:18px;cursor:pointer;line-height:1}
.lulu-body{padding:16px 18px;overflow-y:auto}
.lulu-note{font-size:12px;color:var(--text2);line-height:1.5;margin-bottom:16px}
.lulu-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.lulu-field{display:flex;flex-direction:column;gap:4px}
.lulu-field.lulu-wide{grid-column:1 / -1}
.lulu-field span{font-size:11px;font-weight:700;color:var(--text3);letter-spacing:.5px}
.lulu-field select,.lulu-field input{
  background:var(--surface2);border:1px solid var(--border);border-radius:var(--r-sm);
  padding:9px 10px;font-family:var(--font-ui);font-size:13px;color:var(--text);width:100%;
}
.lulu-price{margin-top:16px;padding:14px;border-radius:var(--r-sm);background:var(--surface2);border:1px solid var(--border);font-size:13px;color:var(--text);line-height:1.6}
.lulu-price .lulu-total{font-size:20px;font-weight:700;color:var(--text)}
.lulu-status{margin-top:12px;padding:12px;border-radius:var(--r-sm);font-size:12px;line-height:1.5}
.lulu-status.ok{background:rgba(46,160,67,.1);color:#1a7f37;border:1px solid rgba(46,160,67,.3)}
.lulu-status.err{background:rgba(109,40,217,.08);color:#d92645;border:1px solid rgba(109,40,217,.28)}
.lulu-status.info{background:var(--surface2);color:var(--text2);border:1px solid var(--border)}
.lulu-preview{margin-top:12px;padding:14px;border-radius:var(--r-sm);background:var(--surface2);border:1px solid var(--border);font-size:12px;line-height:1.6;color:var(--text2)}
.lulu-preview h4{margin:0 0 8px;font-family:var(--font-ui);font-size:13px;font-weight:700;color:var(--text)}
.lulu-preview .lulu-preview-links{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.lulu-preview a.lulu-preview-link{flex:1;min-width:120px;text-align:center;padding:10px;border-radius:var(--r-sm);background:var(--surface);border:1px solid var(--border);color:var(--text);font-weight:700;text-decoration:none}
.lulu-preview iframe{width:100%;height:320px;border:1px solid var(--border);border-radius:var(--r-sm);background:#0a0a0f}
.lulu-preview .lulu-preview-note{margin-top:8px}
.lulu-foot{display:flex;gap:10px;padding:14px 18px calc(14px + var(--safe-bot));border-top:1px solid var(--border);flex-shrink:0}
.lulu-btn{flex:1;padding:12px;border-radius:var(--r-sm);font-family:var(--font-ui);font-size:14px;font-weight:700;cursor:pointer;border:1px solid var(--border)}
.lulu-btn-ghost{background:transparent;color:var(--text)}
.lulu-btn-primary{background:var(--red);color:#fff;border-color:var(--red)}
.lulu-btn:disabled{opacity:.45;cursor:not-allowed}

/* ── PAYMENT ── */
.pw-fmt-btn{background:var(--surface);border:2px solid var(--border);border-radius:var(--r-sm);padding:12px 10px;cursor:pointer;transition:all .18s;text-align:center}
.pw-fmt-btn:active{transform:scale(.97)}
.pw-fmt-btn.sel{border-color:var(--amber);background:rgba(255,224,75,.12)}
.pw-fmt-btn.sel div:first-of-type{color:var(--amber)}
.tier-card{background:var(--surface);border:2px solid var(--border);border-radius:var(--r-sm);padding:14px;cursor:pointer;transition:all .18s}
.tier-card:active{transform:scale(.98)}
.tier-card.sel{background:rgba(63,104,74,.08)}
#paywall{background:var(--bg);align-items:center;justify-content:center;padding:32px 24px;text-align:center}
.pw-icon{width:80px;height:80px;background:linear-gradient(135deg,#30251F,#593A2E);border:1.5px solid #C89B3C;border-radius:22px;display:flex;align-items:center;justify-content:center;margin:0 auto 20px;box-shadow:0 14px 38px rgba(109,40,217,.24);font-size:38px}
.pw-title{font-family:var(--font-display);font-weight:700;font-size:2rem;letter-spacing:2px;color:var(--text);margin-bottom:8px}
.pw-price{font-family:var(--font-display);font-weight:700;font-size:3rem;letter-spacing:0;color:var(--red);margin:16px 0 4px}
.pw-price-sub{font-size:12px;color:var(--text3);margin-bottom:24px}
.pw-features{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:16px;margin-bottom:24px;text-align:left}
.pw-feature{display:flex;align-items:center;gap:10px;padding:5px 0;font-size:13px;color:var(--text2)}
.pw-feature-icon{color:var(--teal);font-size:16px;flex-shrink:0}
.pw-note{font-size:11px;color:var(--text3);margin-top:12px;line-height:1.6}
/* Promo code — collapsed to a text link until asked for (see index.html). */
.pw-promo{margin-bottom:14px;text-align:left}
.pw-promo-toggle{background:none;border:none;padding:0;font-size:12px;color:var(--text3);text-decoration:underline;cursor:pointer;font-family:inherit}
.pw-promo-toggle:hover{color:var(--teal)}
.pw-promo-row{display:flex;gap:8px;margin-top:8px}
.pw-promo-row input{flex:1;min-width:0;padding:10px 12px;font-size:14px;font-family:inherit;text-transform:uppercase;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r)}
.pw-promo-row input:focus{outline:none;border-color:var(--teal)}
.pw-promo-apply{padding:10px 16px;font-size:13px;font-weight:700;font-family:inherit;background:var(--surface);color:var(--text2);border:1px solid var(--border);border-radius:var(--r);cursor:pointer;white-space:nowrap}
.pw-promo-apply:hover{border-color:var(--teal);color:var(--teal)}
.pw-promo-apply:disabled{opacity:.6;cursor:default}
.pw-promo-status{font-size:12px;margin-top:7px;line-height:1.5;min-height:0}
.pw-promo-status.ok{color:var(--teal);font-weight:700}
.pw-promo-status.err{color:#e5534b}
/* ── PRINT UPSELL ── */
.print-upsell{
  border:2px solid var(--border);border-radius:var(--r-sm);
  padding:14px;margin-bottom:16px;transition:border-color .18s,background .18s;
}
.print-upsell.eligible{border-color:var(--amber);background:rgba(255,224,75,.1);cursor:pointer}
.print-upsell.ineligible{opacity:.5}
.print-upsell-row{display:flex;align-items:center;gap:12px}
.print-upsell-check{
  width:22px;height:22px;border-radius:6px;border:2px solid var(--border);
  flex-shrink:0;display:flex;align-items:center;justify-content:center;
  transition:all .15s;background:var(--surface);
}
.print-upsell.eligible .print-upsell-check{border-color:var(--amber)}
.print-upsell.checked .print-upsell-check{background:var(--yellow);border-color:var(--yellow)}
.print-upsell-checkmark{color:#1a1a2e;font-size:13px;font-weight:900;display:none}
.print-upsell.checked .print-upsell-checkmark{display:block}
.print-upsell-label{flex:1}
.print-upsell-title{font-size:13px;font-weight:700;color:var(--text);line-height:1.3}
.print-upsell-sub{font-size:11px;color:var(--text2);margin-top:2px;line-height:1.4}
.print-upsell-price{font-family:var(--font-display);font-weight:700;font-size:1.4rem;letter-spacing:1px;color:var(--amber);flex-shrink:0}
.print-upsell-note{font-size:10px;color:var(--text3);margin-top:8px;line-height:1.5;padding-left:34px}

/* ── AVATAR PREVIEW ── */
#avatar-preview{background:var(--bg)}
#avatar-preview .topbar{position:sticky;top:0;z-index:10;background:var(--bg);padding-top:calc(10px + var(--safe-top))}
.av-scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;padding-bottom:calc(90px + var(--safe-bot))}
.av-scroll::-webkit-scrollbar{display:none}
.char-preview-card{
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--r);margin:0 18px 16px;overflow:hidden;
}
.char-preview-card.approved{border-color:var(--teal)}
.char-preview-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 14px 10px;border-bottom:1px solid var(--border);
}
.char-preview-name{font-family:var(--font-display);font-weight:700;font-size:1.1rem;letter-spacing:1px;color:var(--text)}
.char-preview-role{font-size:10px;font-weight:700;color:var(--text3);letter-spacing:1px;text-transform:uppercase}
/* Two independent shot slots per character: portrait + full body.
   Side by side on wider screens, stacked on narrow phones. */
.av-shots{display:flex;flex-wrap:wrap}
.av-shot{flex:1 1 200px;min-width:0;border-top:1px solid var(--border)}
.av-shot + .av-shot{border-left:1px solid var(--border)}
.av-shot.approved{background:rgba(63,104,74,.05)}
.av-shot-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:9px 14px 7px;
}
.av-shot-title{font-size:11px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:var(--text2)}
.av-shot-opt{color:var(--text3);font-weight:700;text-transform:none;letter-spacing:0}
.av-shot-badge{font-size:12px;font-weight:700;color:var(--teal)}
.av-img-wrap{
  position:relative;
  background:var(--surface2);
  aspect-ratio:1;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
.av-img-wrap img{width:100%;height:100%;object-fit:cover;display:block}
.av-img-wrap .av-loading{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
  background:var(--surface2);
}
.av-img-wrap .av-loading p{font-size:12px;font-weight:700;color:var(--text3)}
.av-desc{padding:10px 14px;font-size:12px;color:var(--text2);line-height:1.6;border-bottom:1px solid var(--border)}
.av-actions{display:flex;gap:8px;padding:10px 14px}
.av-action-btn{
  flex:1;padding:10px 8px;border-radius:var(--r-sm);
  font-family:var(--font-ui);font-size:12px;font-weight:700;
  cursor:pointer;text-align:center;transition:all .15s;border:1.5px solid var(--border);
  background:var(--surface2);color:var(--text2);
}
.av-action-btn:active{transform:scale(.97)}
.av-action-btn.approve{border-color:var(--teal);background:rgba(63,104,74,.11);color:var(--teal)}
.av-action-btn.retry-free{border-color:var(--amber);background:rgba(255,224,75,.14);color:var(--amber)}
.av-action-btn.retry-paid{border-color:var(--red);background:rgba(109,40,217,.08);color:var(--red)}
.av-action-btn.approved-state{border-color:var(--teal);background:rgba(63,104,74,.15);color:var(--teal);pointer-events:none}
.av-retry-note{font-size:10px;color:var(--text3);padding:0 14px 10px;text-align:center;line-height:1.5}
/* Avatar carousel — every kept generation, tap to choose */
.av-carousel{
  display:flex;gap:8px;padding:10px 14px;overflow-x:auto;
  border-bottom:1px solid var(--border);-webkit-overflow-scrolling:touch;
}
.av-thumb{
  flex:0 0 auto;width:60px;padding:0;border:2px solid var(--border);
  border-radius:var(--r-sm);background:var(--surface2);cursor:pointer;
  overflow:hidden;display:flex;flex-direction:column;align-items:center;
  transition:border-color .15s;
}
.av-thumb img{width:100%;height:56px;object-fit:cover;display:block}
.av-thumb span{font-size:8px;font-weight:700;color:var(--text3);padding:3px 2px;
  text-align:center;letter-spacing:.3px;line-height:1.1;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis;max-width:100%}
.av-thumb.sel{border-color:var(--teal)}
.av-thumb.sel span{color:var(--teal)}
/* Reroll edit instruction */
.av-edit-row{padding:8px 14px 0}
.av-edit-input{
  width:100%;box-sizing:border-box;padding:8px 10px;
  border:1.5px solid var(--border);border-radius:var(--r-sm);
  background:var(--surface2);color:var(--text);
  font-family:var(--font-ui);font-size:12px;
}
.av-edit-input::placeholder{color:var(--text3)}
.av-edit-input:focus{outline:none;border-color:var(--amber)}
.av-bottom-bar{
  position:fixed;bottom:0;left:0;right:0;
  padding:12px 18px calc(12px + var(--safe-bot));
  background:linear-gradient(transparent, rgba(244,235,216,.98) 30%);
}
.av-progress-strip{
  display:flex;gap:6px;margin:0 18px 14px;flex-wrap:wrap;
  justify-content:center;
}
.av-char-dot{
  display:flex;align-items:center;gap:5px;
  font-size:10px;font-weight:700;color:var(--text3);
  background:var(--surface);border:1px solid var(--border);
  border-radius:20px;padding:3px 10px;
}
.av-char-dot.done{color:var(--teal);border-color:var(--teal)}
.av-char-dot.active{color:var(--amber);border-color:var(--amber)}

/* ── FORMAT VIEWERS ── */

/* Children's book */
.cb-page{background:#fff;border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:20px;box-shadow:0 8px 30px rgba(26,26,46,.12)}
/* Pages are generated at SCENE_ASPECT (3:4 portrait). Forcing them into a
   4:3 landscape box with object-fit:cover cropped away the top and bottom of
   every illustration — slicing off the characters (heads/bodies) the page is
   about. Like the full-comic and graphic-novel formats, show the WHOLE art
   uncropped at its own aspect (height:auto) so nothing is cut; this also
   matches the canvas PNG/JPG/PDF export, which already draws the page image
   at its natural ratio. */
.cb-img{width:100%;height:auto;object-fit:contain;display:block}
.cb-text{padding:18px 20px 20px;background:#fffef8;border-top:3px solid #111;position:relative}
.cb-text p{font-family:'Caveat',cursive,sans-serif;font-size:21px;line-height:1.55;color:#1a1a1a;text-align:center}
/* Front/back matter preview pages — the cream, text-only leaves printed around
   the story (title, dedication, "The End"). Mirror the print renderers so what
   the reader sees on screen matches the book they'll order. */
.cb-matter-bar{display:flex;justify-content:center;margin-bottom:16px}
body.share-mode .cb-matter-bar{display:none}
.cb-matter-bar button{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);
  color:var(--text);font-family:var(--font-ui);font-size:12px;font-weight:700;padding:9px 16px;cursor:pointer}
.cb-matter-bar button:active{transform:scale(.97)}
.cb-matter-page{background:#fbf3e7;aspect-ratio:1/1;display:flex;align-items:center;justify-content:center;text-align:center;padding:32px 26px}
.edit-mode-active .cb-matter-page{cursor:pointer}
.edit-mode-active .cb-matter-page:hover{outline:2px dashed #ffe04b;outline-offset:-6px}
.cbm-inner{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;width:100%}
.cbm-title{font-family:'Bangers',cursive;font-size:2rem;letter-spacing:1.5px;color:#2a2320;line-height:1.1}
.cbm-tagline{font-family:Georgia,serif;font-style:italic;font-size:1rem;color:#6b5d50}
.cbm-foot{font-family:var(--font-ui);font-size:.72rem;font-weight:700;letter-spacing:.5px;color:#8a7a6a;margin-top:8px}
.cbm-label{font-family:var(--font-ui);font-size:.9rem;font-weight:700;color:#2a2320}
.cbm-ded{font-family:'Bangers',cursive;font-size:1.5rem;letter-spacing:1px;color:#2a2320}
.cbm-line{width:60%;border-bottom:2px solid #8a7a6a;height:1px}
.cbm-closing{font-family:Georgia,serif;font-style:italic;font-size:.9rem;color:#8a7a6a;margin-top:6px}
/* CB text toolbar */
.cb-text-toolbar{
  display:none;position:relative;left:auto;top:auto;transform:none;
  background:#1a1025;border:1px solid #333;border-radius:8px;
  padding:8px;box-shadow:0 4px 16px rgba(0,0,0,.7);
  flex-direction:column;gap:6px;z-index:50;margin-bottom:8px;
}
.cb-text-toolbar.show{display:flex}
.cbt-row{display:flex;flex-direction:row;gap:5px;align-items:center;flex-wrap:wrap}
.cbt-btn{padding:4px 9px;border:none;border-radius:4px;
  background:rgba(255,255,255,.12);color:#fff;font-size:11px;
  cursor:pointer;font-weight:700;font-family:var(--font-ui)}
.cbt-btn:hover{background:rgba(255,255,255,.25)}
.cbt-btn.active{background:var(--yellow);color:#111}
.cbt-sep{width:1px;height:20px;background:rgba(255,255,255,.15)}
.cbt-font-size{display:flex;align-items:center;gap:3px}
.cbt-size-lbl{font-size:10px;color:#aaa;min-width:28px;text-align:center;font-weight:700}
.cbt-select{background:#1a1025;border:1px solid #444;color:#fff;
  font-size:11px;border-radius:4px;padding:3px 6px;cursor:pointer;flex:1;min-width:100px}
.cbt-label{font-size:9px;color:#777;font-weight:700;letter-spacing:.5px;text-transform:uppercase}

/* Full comic */
.fc-page{background:#fff;border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:20px;box-shadow:0 8px 30px rgba(26,26,46,.12)}
.fc-header{background:#111;padding:5px 12px;display:flex;justify-content:space-between;border-bottom:2px solid var(--red)}
.fc-header span{font-size:9px;font-weight:700;color:#888;letter-spacing:1px}
/* Full Comic — asymmetric comic pages. Each chapter is ONE page of rows of
   differently shaped panels (ch._layout). The art is generated at each cell's
   exact aspect ratio, and within a row flex-grow ∝ ratio makes widths ∝
   ratios, so every cell in a row lands on the same art height — asymmetric
   composition with zero cropping. White gutters + inked borders = classic
   comic page. The export's _renderFcGridPageCanvas applies the same math. */
.fc-grid{display:flex;flex-direction:column;gap:8px;background:#fff;padding:10px}
.fc-row{display:flex;gap:8px;align-items:stretch}
.fc-panel{background:#111;position:relative;overflow:hidden;flex-shrink:0;container-type:inline-size}
.fc-panel img{width:100%;height:100%;display:block;object-fit:cover;object-position:center var(--scene-crop-y)}
/* The cell box itself must stay transparent: the .fc-panel #111 base would
   otherwise show as a dark wedge in the diagonal-cut corners outside the clip
   layers. The ink/art layers below carry the visible backgrounds. */
.fc-cell{display:flex;flex-direction:column;min-width:0;background:transparent}
/* Diagonal-gutter clip layers (see gridCell in 09-viewer.js): the outer .fc-ink
   is the black panel border — the inner .fc-art carries the same polygon inset
   2px, so the ring of ink showing around it draws the border along the slants
   (a plain CSS border can't follow a clip-path). Buttons and speech bubbles
   attach to .fc-cell itself, outside the clip. */
.fc-ink{background:#14141e;flex:1;display:flex;flex-direction:column;min-height:0}
.fc-art{background:#111;flex:1;display:flex;flex-direction:column;min-height:0}
/* Bands in a row stretch to the tallest so cell bottoms stay flush. */
.fc-cell .fc-narration{flex:1}
.fc-cell .pph{background:#0d0d0d;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;width:100%}
/* Full-width stacked panels (webtoon-style): whole art, never cropped, with a
   narration band beneath. */
.fc-stack{display:flex;flex-direction:column;gap:3px;background:#222;padding:3px}
.fc-panel.fc-stacked{width:100%;flex:none}
.fc-panel.fc-stacked img{height:auto;object-fit:contain}
/* Narration band under the art — classic cream "caption box". Colors MUST
   match CC_NARRATION_* in 12-export.js (and the export's _drawCaptionBar) so
   the viewer and the downloaded/printed page read identically. */
.fc-narration{background:#fbeeba;color:#1c1208;font-family:Arial,sans-serif;
  font-weight:700;font-size:12px;line-height:1.35;text-align:center;
  letter-spacing:.2px;padding:8px 12px;border-top:3px solid #1c1208}
/* Base bubble.
   max-width is 46% so the on-screen bubble matches what the in-app editor and
   the exports actually draw — _drawBubble() in 12-export.js caps an unsized
   bubble at 46% of the image box and notes it is "matching the CSS max-width on
   unsized on-screen bubbles". This used to be 80%, so bubbles looked far wider
   on screen than in the download, which made the editor impossible to trust. */
/* Padding, border and shadow are sized in em (relative to the bubble's own
   font-size) rather than fixed px. The font-size is set as a fraction of the
   panel WIDTH (see restoreBubblePositions), so em-based box metrics scale with
   the panel too — the whole box occupies the same fraction of the panel at any
   size. Fixed-px padding/border did NOT scale, so a bubble measured against a
   large fullscreen-editor panel and re-rendered on a small on-page panel grew a
   proportionally taller box (more padding-per-pixel), which pushed its bottom
   edge down and clipped it — the editor-vs-viewer discrepancy. */
/* Letter the bubble in Arial, NOT the inherited body font ('Syne'). The
   auto-lettered preview overlay (.fc-letter) and the PDF/PNG canvas export
   (_drawBubble → 'Arial, sans-serif') both draw in Arial, so a bubble that
   fell back to Syne — a much WIDER display face — wrapped the same caption to
   more lines and grew a taller box the moment it became a real editable
   bubble. That is the before-edit/after-edit "jump": the centred preview and
   the download read one way, the bubble the user actually edits and saves read
   another. Pinning the font (and line-height 1.25, matching .fc-letter) makes
   the preview, the editable bubble and the export letter identically. */
.fc-bubble{position:absolute;top:6px;left:6px;background:#fff;border:.15em solid #111;
  border-radius:10px;padding:.4em .62em;font-family:Arial,sans-serif;font-size:9px;font-weight:700;color:#111;
  line-height:1.25;max-width:46%;box-shadow:.15em .15em 0 rgba(0,0,0,.3);
  word-wrap:break-word;min-width:40px;
  display:flex;align-items:center;justify-content:center;text-align:center}
/* Auto (unmoved) caption bubble: sit at the same 3% inset the export uses, so
   the on-screen position is exactly where the download places it. */
.fc-bubble.default-bubble{top:3%;left:3%}

/* Bubble style presets */
.fc-bubble.style-speech{background:#fff;border:.15em solid #111;border-radius:10px;color:#111}
.fc-bubble.style-shout{background:#ffe04b;border:.23em solid #111;border-radius:4px;
  font-size:10px;transform:rotate(-1deg);color:#111;letter-spacing:.5px}
.fc-bubble.style-thought{background:#fff;border:.15em dashed #888;border-radius:50%;
  padding:.54em .77em;color:#333;font-style:italic;font-weight:400}
.fc-bubble.style-whisper{background:rgba(255,255,255,.85);border:.08em dashed #999;
  border-radius:10px;color:#666;font-weight:400;font-style:italic;font-size:8px}
.fc-bubble.style-caption{background:#ffe04b;border:none;border-radius:0;
  color:#111;font-weight:700;font-size:9px;letter-spacing:.5px;text-transform:uppercase;
  box-shadow:none;left:0!important;right:0!important;max-width:100%!important;
  top:auto!important;bottom:0!important;border-top:2px solid #111}
.fc-bubble.style-narration{background:#1a1025;border:none;border-radius:0;
  color:#e8e0ff;font-weight:400;font-style:italic;font-size:9px;
  box-shadow:none;left:0!important;right:0!important;max-width:100%!important;top:0!important}
/* Bounded (non-full-width) yellow caption box — the classic square-cornered
   narration box tucked into a panel corner, as opposed to style-caption's
   full-width band. This is what auto-lettering produces for narration lines
   (_synthLetterBubble → style-captionbox), so the editor/viewer render it
   exactly like the PDF/PNG export. Unlike style-caption it keeps whatever
   left/top/width the bubble was placed at, so it stays draggable. */
.fc-bubble.style-captionbox{background:#ffe04b;border:.15em solid #111;border-radius:0;
  color:#111;font-weight:700;font-size:9px;letter-spacing:.3px;
  box-shadow:.15em .15em 0 rgba(0,0,0,.25);
  align-items:flex-start;justify-content:flex-start;text-align:left}

/* Auto-lettering preview overlay (see renderPanelInner / _synthLetterBubble in
   12-export.js): an in-panel caption box (narration) or speech balloon
   (dialogue) that mirrors what the PDF/PNG export draws, so the on-screen page
   matches the download. Non-interactive — the ＋ button and fullscreen editor
   still add real draggable bubbles, which take over once the book is saved. */
.fc-letter{position:absolute;z-index:2;pointer-events:none;box-sizing:border-box;
  font-family:Arial,sans-serif;font-weight:700;font-size:10px;line-height:1.25;
  color:#111;word-wrap:break-word;overflow:hidden;display:flex;align-items:center}
/* Match the PDF/PNG export's lettering, which sizes the font as a fraction of
   the panel WIDTH (_synthLetterBubble fontScale 0.036 in 12-export.js). The old
   fixed 10px was far larger than the export on the narrow side-panels of a
   multi-panel row, so long captions overflowed the box (the clipped/spilling
   caption bug). 3.6cqw = 3.6% of the panel width reproduces the export exactly,
   so the on-screen page reads as a faithful thumbnail of the printed page.
   Browsers without container-query units keep the 10px fallback above. */
.fc-panel .fc-letter{font-size:3.6cqw}
/* Narration → classic square-cornered yellow caption box, top-left corner */
/* em-based padding/border so the overlay renders identically to the saved
   .fc-bubble it becomes after editing (both scale with the panel width). */
/* `top` in cqw (fraction of panel WIDTH), matching _synthLetterBubble's
   width-fraction topFrac — a plain `top:%` is height-relative, so on a portrait
   panel the un-edited overlay sat lower than the bubble it becomes after
   editing. The `%` line stays first as a fallback for browsers without
   container-query units (which also keep the .fc-letter px font fallback). */
.fc-capbox{left:4.5%;top:4.5%;top:4.5cqw;max-width:44%;background:#ffe04b;border:.15em solid #111;
  border-radius:0;padding:.4em .62em;text-align:left;justify-content:flex-start;
  box-shadow:.15em .15em 0 rgba(0,0,0,.25)}
/* Dialogue → white speech balloon in the art headroom, horizontally centred */
.fc-balloon{left:25%;width:50%;top:5%;top:5cqw;background:#fff;border:.15em solid #111;
  border-radius:12px;padding:.4em .62em;text-align:center;justify-content:center;
  box-shadow:.15em .15em 0 rgba(0,0,0,.3)}

/* Directional speech-balloon tails — the on-screen mirror of _drawBubbleTail in
   12-export.js. A downward pointer at the speaking character (left/center/right
   maps to Claude's per-panel `zone`). Two stacked CSS triangles: the #111 one is
   the outline, the fill one sits just above it so only the two diagonal border
   edges show and the base blends into the balloon. Scoped to speech/shout
   balloons so caption boxes, thought and narration styles stay tail-less, exactly
   like the export. Sizes are in em (relative to the bubble font, itself a
   fraction of the panel width) so the tail scales with the panel like the box. */
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout):is(.tail-left,.tail-center,.tail-right){overflow:visible}
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout):is(.tail-left,.tail-center,.tail-right)::before,
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout):is(.tail-left,.tail-center,.tail-right)::after{
  content:"";position:absolute;top:100%;width:0;height:0;
  border-left:.5em solid transparent;border-right:.5em solid transparent;pointer-events:none}
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout):is(.tail-left,.tail-center,.tail-right)::before{
  border-top:.62em solid #111}
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout):is(.tail-left,.tail-center,.tail-right)::after{
  border-top:.5em solid #fff;margin-top:-.14em}
/* Shout balloons are yellow, so their tail fill must match. */
.fc-bubble.style-shout.tail-left::after,.fc-bubble.style-shout.tail-center::after,.fc-bubble.style-shout.tail-right::after{border-top-color:#ffe04b}
/* Once the user drags the tail to a precise anchor, the SVG layer draws it
   instead, so suppress the CSS zone pointer for that bubble. */
.fc-bubble.tail-custom::before,.fc-bubble.tail-custom::after{display:none!important}
/* SVG overlay that draws user-aimed tails. It sits ABOVE the bubbles so the tail
   base overlaps and blends into the balloon; it is transparent everywhere else
   (and pointer-transparent), so bubble text and clicks pass straight through. */
.fc-tail-layer{position:absolute;left:0;top:0;pointer-events:none;z-index:5;overflow:visible}
.fc-bubble{z-index:3}
/* Draggable tail-aim handle (fullscreen editor only). */
.fc-tail-handle{position:absolute;width:20px;height:20px;margin:-10px 0 0 -10px;border-radius:50%;
  background:var(--teal,#00a58c);border:2px solid #fff;box-shadow:0 1px 5px rgba(0,0,0,.55);
  z-index:31;cursor:grab;touch-action:none}
.fc-tail-handle::after{content:"";position:absolute;left:50%;top:50%;width:6px;height:6px;
  margin:-3px 0 0 -3px;border-radius:50%;background:#fff}
.fc-tail-handle:active{cursor:grabbing;transform:scale(1.12)}
/* Horizontal placement + a slight lean toward the speaker. */
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-center::before,
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-center::after{left:50%;transform:translateX(-50%)}
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-left::before,
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-left::after{left:30%;transform:translateX(-50%) skewX(16deg)}
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-right::before,
:is(.fc-balloon,.fc-bubble.style-speech,.fc-bubble.style-shout).tail-right::after{left:70%;transform:translateX(-50%) skewX(-16deg)}

/* Bubble toolbar (shows on tap in edit mode) */
.bubble-toolbar{
  display:none;position:absolute;z-index:30;
  background:#1a1025;border:1px solid #333;border-radius:8px;
  padding:6px;box-shadow:0 4px 16px rgba(0,0,0,.6);
  flex-direction:column;gap:4px;min-width:160px;
}
.bubble-toolbar.show{display:flex}
.bt-row{display:flex;gap:4px}
.bt-btn{flex:1;padding:5px 4px;border:none;border-radius:5px;
  font-size:9px;font-weight:700;cursor:pointer;font-family:var(--font-ui);
  background:rgba(255,255,255,.1);color:#fff;text-align:center;white-space:nowrap}
.bt-btn:hover{background:rgba(255,255,255,.2)}
.bt-btn.del{background:rgba(255,61,90,.2);color:var(--red)}
.bt-btn.del:hover{background:rgba(109,40,217,.32)}
.bt-style-row{display:flex;gap:3px;flex-wrap:wrap}
.bt-style{width:26px;height:20px;border-radius:4px;border:2px solid transparent;
  cursor:pointer;font-size:10px;display:flex;align-items:center;justify-content:center}
.bt-style.active{border-color:var(--yellow)}
/* Font size row in bubble toolbar */
.bt-font-row{display:flex;align-items:center;gap:4px}
.bt-font-label{font-size:9px;color:#aaa;flex:1;text-align:center}
.bt-font-btn{width:22px;height:22px;border:none;border-radius:4px;
  background:rgba(255,255,255,.12);color:#fff;font-size:13px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;line-height:1;font-weight:700}
.bt-font-btn:hover{background:rgba(255,255,255,.25)}
/* Resize handles */
.bubble-resize-handle{
  position:absolute;width:10px;height:10px;background:#ffe04b;border:2px solid #111;
  border-radius:2px;z-index:40;box-sizing:border-box;
}
.brh-nw{top:-5px;left:-5px;cursor:nw-resize}
.brh-n {top:-5px;left:50%;transform:translateX(-50%);cursor:n-resize}
.brh-ne{top:-5px;right:-5px;cursor:ne-resize}
.brh-e {top:50%;right:-5px;transform:translateY(-50%);cursor:e-resize}
.brh-se{bottom:-5px;right:-5px;cursor:se-resize}
.brh-s {bottom:-5px;left:50%;transform:translateX(-50%);cursor:s-resize}
.brh-sw{bottom:-5px;left:-5px;cursor:sw-resize}
.brh-w {top:50%;left:-5px;transform:translateY(-50%);cursor:w-resize}
.fc-bubble.resizing{user-select:none}

/* Graphic novel */
.gn-page{background:#f8f6f0;border:1px solid var(--border);border-radius:12px;overflow:hidden;margin-bottom:20px;box-shadow:0 8px 30px rgba(26,26,46,.12)}
.gn-header{background:#1a1025;padding:6px 14px;display:flex;justify-content:space-between;border-bottom:2px solid var(--red)}
.gn-header span{font-size:9px;font-weight:700;color:#888;letter-spacing:1px}
.gn-splash{width:100%;aspect-ratio:16/9;object-fit:cover;object-position:center var(--scene-crop-y);display:block}
.gn-narration{padding:14px 16px;background:#f8f6f0;border-bottom:1px solid #ddd;font-size:12px;font-style:italic;color:#333;line-height:1.8}
/* Graphic Novel — cinematic film-like panels */
.gn-panels{display:flex;flex-direction:column;gap:4px;padding:4px;background:#111}
.gn-panel-row{display:flex;gap:4px}
.gn-panel{flex:1;display:flex;flex-direction:column;position:relative}
.gn-panel.wide-panel img{aspect-ratio:16/9}
.gn-panel.tall-panel img{aspect-ratio:9/16}
.gn-panel.sq-panel img{aspect-ratio:4/3}
.gn-panel img{width:100%;object-fit:cover;object-position:center var(--scene-crop-y);display:block}
/* Full-width stacked panels: whole art, no cover-crop, no forced aspect cell. */
.gn-panels.gn-stack{gap:10px}
.gn-panel.gn-stacked{flex:none;width:100%}
.gn-panel.gn-stacked img{aspect-ratio:auto;height:auto;object-fit:contain}
.gn-panel-text{background:rgba(0,0,0,.85);padding:6px 8px;font-size:10px;
  color:#ddd;line-height:1.6;font-style:italic;min-height:28px;
  font-family:Georgia,serif;letter-spacing:0.2px}
.gn-narration{padding:12px 16px;background:#0d0d18;
  font-size:12px;font-style:italic;color:#b0b0c8;
  font-family:Georgia,serif;line-height:1.8;
  border-left:3px solid var(--red);border-bottom:1px solid #1a1a2a}

/* ── IN-APP EDITOR ── */
/* Comic Strip captions and Children's Book text stay inline-editable (those
   formats have no fullscreen panel editor). Full Comic and Graphic Novel do:
   their captions, narration bands and speech bubbles are DISPLAY-ONLY on the
   page — a faithful thumbnail — and all editing happens inside the panel editor
   (the ⛶ button on each panel → openPanelEditor). See below for the read-only
   scoping. */
.edit-mode-active .pcap,
.edit-mode-active .cb-text p { cursor:pointer; }

.edit-mode-active .pcap:hover { background:#fffbe6; outline:2px dashed #ffe04b; }
.edit-mode-active .cb-text p:hover { background:#fffbe6; outline:2px dashed #ffe04b; }

/* Faithful, read-only thumbnail: on the page, Full Comic / Graphic Novel text
   and bubbles never intercept taps or drags, so the page can't be edited in
   place. The panel editor moves the panel OUT of #bookPages into .pe-stage, so
   these rules don't apply there — bubbles stay fully draggable/editable inside
   the editor. */
#bookPages .fc-narration,
#bookPages .gn-panel-text,
#bookPages .fc-bubble { pointer-events:none; }
#bookPages .fc-bubble { cursor:default; }

/* Edit mode toggle in viewer topbar */
.edit-btn-active { background:var(--yellow) !important; color:#111 !important; border-color:var(--yellow) !important; }

/* Inline caption editor */
.caption-editor {
  width:100%;min-height:40px;padding:4px 5px;
  font-size:9px;font-weight:700;color:#111;line-height:1.35;
  font-family:var(--font-ui);
  background:#fffbe6;border:2px solid #ffe04b;outline:none;
  resize:vertical;box-sizing:border-box;
}
.caption-editor.cb { font-size:20px;line-height:1.55;text-align:center;font-family:'Caveat',cursive,sans-serif; min-height:60px; }
.caption-editor.gn { font-size:10px;color:#ddd;background:#1a1a2a;border-color:#ffe04b;font-style:italic;font-family:Georgia,serif; }
.caption-editor.bubble { font-size:9px;font-weight:700;font-family:var(--font-ui);min-height:36px;background:#fffbe6; }

/* Draggable speech bubble (inside the panel editor). On the page bubbles are
   read-only (pointer-events:none, set above), so the dashed "editable" outline
   would be misleading — it's only shown inside the editor stage. */
.fc-bubble { cursor:grab; user-select:none; }
.fc-bubble.dragging { cursor:grabbing; opacity:.85; z-index:10; }
.pe-stage .fc-bubble { border:2px dashed #ffe04b !important; }

/* Panel drag-reorder */
.edit-mode-active .pcell,
.edit-mode-active .fc-panel,
.edit-mode-active .gn-panel { cursor:grab; }
.panel-drag-over { outline:3px dashed var(--teal) !important; }
.panel-dragging { opacity:.5; }

/* Editor toolbar that appears on panel long-press */
.panel-toolbar {
  display:none;position:absolute;top:4px;right:4px;z-index:20;
  display:flex;gap:4px;background:rgba(0,0,0,.8);
  border-radius:6px;padding:4px;
}
.ptool-btn {
  font-size:11px;padding:4px 7px;background:rgba(255,255,255,.15);
  border:none;border-radius:4px;color:#fff;cursor:pointer;
  font-family:var(--font-ui);font-weight:700;
}
.ptool-btn:hover { background:rgba(255,255,255,.3); }

/* Add bubble button */
.add-bubble-btn {
  display:none;position:absolute;bottom:36px;right:6px;z-index:15;
  background:var(--yellow);border:none;border-radius:50%;
  width:24px;height:24px;font-size:13px;cursor:pointer;
  align-items:center;justify-content:center;line-height:1;
  box-shadow:1px 1px 4px rgba(0,0,0,.5);
}
/* The on-page ＋ is gone: adding a speech bubble happens inside the panel
   editor (its own ＋ Add speech bubble button), so the page stays a clean,
   read-only thumbnail. The .add-bubble-btn stays display:none everywhere. */

/* Edit mode banner */
.edit-banner {
  display:none;background:#ffe04b;color:#111;
  font-size:10px;font-weight:700;text-align:center;
  padding:5px;letter-spacing:.5px;
}
.edit-banner.show { display:block; }

/* Per-panel "edit fullscreen" entry point (full comic). Always available so a
   phone user has an obvious way in without hunting for global edit mode. */
.panel-expand-btn {
  position:absolute;top:5px;right:5px;z-index:16;
  background:rgba(0,0,0,.55);color:#fff;border:none;border-radius:6px;
  width:26px;height:26px;font-size:13px;cursor:pointer;line-height:1;
  display:flex;align-items:center;justify-content:center;
  -webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);
}
.panel-expand-btn:hover,.panel-expand-btn:active{background:rgba(0,0,0,.8)}
.share-mode .panel-expand-btn { display:none; }   /* read-only shared view */

/* Per-image AI redraw button — edit mode only. Top-left so it never collides
   with the expand (top-right) or add-bubble (bottom-right) controls. */
.pcell{position:relative}
.redraw-btn{
  position:absolute;top:5px;left:5px;z-index:16;
  background:rgba(0,0,0,.55);color:var(--yellow);border:none;border-radius:6px;
  width:26px;height:26px;font-size:14px;cursor:pointer;line-height:1;
  display:none;align-items:center;justify-content:center;
  -webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);
}
.redraw-btn:hover,.redraw-btn:active{background:rgba(0,0,0,.8)}
.edit-mode-active .redraw-btn{display:flex}
.share-mode .redraw-btn,.pe-stage .redraw-btn{display:none!important}

/* ── FULLSCREEN SINGLE-PANEL EDITOR ── */
.pe-overlay {
  position:fixed;inset:0;z-index:9990;background:var(--bg);
  display:flex;flex-direction:column;
  padding-top:var(--safe-top);padding-bottom:var(--safe-bot);
}
.pe-bar { flex-shrink:0;display:flex;align-items:center;gap:10px;padding:10px 14px; }
.pe-top { justify-content:space-between;border-bottom:1px solid var(--border); }
.pe-title { font-family:var(--font-ui);font-weight:700;font-size:14px;color:var(--text);letter-spacing:.5px; }
.pe-done {
  background:var(--yellow);color:#111;border:none;border-radius:8px;
  font-family:var(--font-ui);font-weight:700;font-size:14px;padding:8px 20px;cursor:pointer;
}
.pe-canvas { flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;min-height:0; }
.pe-stage { position:relative;background:#111;box-shadow:0 8px 32px rgba(26,26,46,.22);overflow:hidden; }
.pe-stage .fc-panel,
.pe-stage .gn-panel { width:100%!important;height:100%!important; }
/* The page's tiny in-panel chrome is replaced by the big bottom-bar controls. */
.pe-stage .add-bubble-btn,
.pe-stage .panel-expand-btn { display:none!important; }
.pe-bottom { flex-direction:column;align-items:stretch;gap:6px;border-top:1px solid var(--border); }
.pe-add {
  background:var(--teal);color:#04241f;border:none;border-radius:10px;
  font-family:var(--font-ui);font-weight:700;font-size:15px;padding:13px;cursor:pointer;
}
.pe-add:hover,.pe-add:active{ filter:brightness(1.06); }
.pe-add.armed { background:var(--yellow);color:#111; }
.pe-hint { font-size:10px;color:var(--text3);text-align:center; }

/* Tap-to-place: while armed, the panel shows a crosshair and a soft highlight
   so it's obvious the next tap drops the bubble. The overlay must not eat the
   pointer (pointer-events:none) or it would swallow the placement tap. */
.fc-panel.placing-bubble,
.gn-panel.placing-bubble { cursor:crosshair; }
.fc-panel.placing-bubble::after,
.gn-panel.placing-bubble::after {
  content:'';position:absolute;inset:0;z-index:14;pointer-events:none;
  background:rgba(255,224,75,.12);box-shadow:inset 0 0 0 2px rgba(255,224,75,.7);
}
/* Fatter, finger-sized resize handles inside the big editor. */
.pe-stage .bubble-resize-handle { width:16px;height:16px; }
.pe-stage .brh-nw{top:-8px;left:-8px}.pe-stage .brh-ne{top:-8px;right:-8px}
.pe-stage .brh-se{bottom:-8px;right:-8px}.pe-stage .brh-sw{bottom:-8px;left:-8px}
.pe-stage .brh-n{top:-8px}.pe-stage .brh-s{bottom:-8px}
.pe-stage .brh-e{right:-8px}.pe-stage .brh-w{left:-8px}

/* ── LIBRARY ── */
.lib-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px;padding:18px}
.lt{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);overflow:hidden;cursor:pointer;transition:transform .12s;position:relative}
.lt-del{position:absolute;top:6px;right:6px;z-index:2;width:26px;height:26px;border-radius:50%;border:none;background:rgba(0,0,0,.55);color:#fff;font-size:13px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.lt-del:hover{background:var(--red)}
.lt:active{transform:scale(.96)}
.lt img,.lt .lt-ph{width:100%;aspect-ratio:2/3;object-fit:cover;display:block;background:var(--surface2)}
.lt .lt-ph{display:flex;align-items:center;justify-content:center;font-size:32px}
.lt-info{padding:8px 10px}
.lt-name{font-size:11px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lt-date{font-size:9px;color:var(--text3);margin-top:2px}
/* "Continue as Book N" on a library tile. Full-width and quiet: it must read as
   the tile's second action, not compete with opening the book. */
.lt-seq{display:block;width:100%;margin-top:7px;padding:5px 6px;font-family:inherit;font-size:10px;font-weight:700;line-height:1.3;color:var(--teal);background:transparent;border:1px solid var(--border);border-radius:var(--r);cursor:pointer;text-align:center}
.lt-seq:hover{border-color:var(--teal);background:rgba(63,104,74,.1)}
.lib-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:60vh;gap:10px;text-align:center;padding:40px}
.lib-empty span{font-size:52px;opacity:.35}
.lib-empty p{font-size:14px;color:var(--text2);line-height:1.7}

/* ── ACCOUNT / AUTH ── */
.auth-modal{position:fixed;inset:0;z-index:9995;background:rgba(26,26,46,.5);display:none;align-items:center;justify-content:center;padding:20px}
.auth-modal.show{display:flex}
.auth-panel{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:24px;max-width:340px;width:100%}
.auth-title{font-family:var(--font-display);font-weight:700;font-size:1.4rem;letter-spacing:2px;color:var(--text);margin-bottom:4px}
.auth-sub{font-size:12px;color:var(--text2);margin-bottom:20px;line-height:1.6}
.auth-input{width:100%;padding:12px 14px;background:var(--surface2);border:1.5px solid var(--border);border-radius:var(--r-sm);font-family:var(--font-ui);font-size:14px;color:var(--text);outline:none;margin-bottom:10px;-webkit-appearance:none}
.auth-input:focus{border-color:var(--teal)}
.auth-input::placeholder{color:var(--text3)}
.auth-err{font-size:12px;color:var(--red);margin-bottom:10px;display:none;line-height:1.5}
.auth-err.show{display:block}
.auth-switch{font-size:12px;color:var(--text3);text-align:center;margin-top:12px;cursor:pointer}
.auth-switch span{color:var(--teal)}
.sync-banner{background:rgba(63,104,74,.09);border:1px solid rgba(63,104,74,.22);border-radius:var(--r-sm);padding:12px 14px;margin:0 18px 14px;display:none}
.sync-banner.show{display:block}
.sync-banner-title{font-size:12px;font-weight:700;color:var(--teal);margin-bottom:4px}
.sync-banner-text{font-size:11px;color:var(--text2);line-height:1.5}
.account-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);padding:14px;margin-bottom:12px}
.account-email{font-size:13px;font-weight:700;color:var(--text)}
.account-stats{font-size:11px;color:var(--text3);margin-top:3px}

/* ── SETTINGS ── */
.settings-pad{padding:18px}
.settings-about{text-align:center;padding:12px 0 8px}
.settings-appname{font-family:var(--font-display);font-weight:700;font-size:2rem;letter-spacing:2px;color:var(--red)}
.settings-ver{font-size:11px;color:var(--text3);margin-top:3px}
.settings-desc{font-size:12px;color:var(--text2);line-height:1.7;margin-top:12px}
.sbtn{width:100%;padding:14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);font-family:var(--font-ui);font-size:13px;font-weight:700;color:#ef4444;cursor:pointer;text-align:left;margin-bottom:8px}

/* ── TOAST ── */
.toast{
  position:fixed;bottom:calc(76px + var(--safe-bot) + 8px);left:16px;right:16px;
  background:#2A211B;color:#F4EBD8;border:1px solid #C89B3C;border-radius:11px;padding:13px 15px;
  font-size:12px;font-weight:600;box-shadow:0 10px 28px rgba(23,28,24,.35);
  opacity:0;transform:translateY(8px);
  transition:opacity .25s,transform .25s;z-index:200;pointer-events:none;
}
.toast.show{opacity:1;transform:none}

/* ── PAGE-FLIP VIEWER ─────────────────────────────────────────
   Optional "read like a book" mode. #bookPages switches from a vertical
   scroll to a stack of absolutely-positioned pages, one visible at a time,
   turned with a 3D flip. Format-agnostic: it flips whatever top-level pages
   the current format rendered. */
#viewerScroll.flip-active{overflow:hidden}
.book-pages.flip-mode{
  position:relative;height:100%;padding:0;gap:0;display:block;
  perspective:2200px;background:var(--bg);
}
.book-pages.flip-mode > *{
  position:absolute;top:0;left:0;right:0;bottom:0;margin:0;
  overflow-y:auto;-webkit-overflow-scrolling:touch;
  border-radius:0;box-shadow:0 0 42px rgba(26,26,46,.4);
  backface-visibility:hidden;-webkit-backface-visibility:hidden;
  opacity:0;pointer-events:none;will-change:transform,opacity;
}
.book-pages.flip-mode > *::-webkit-scrollbar{display:none}
.book-pages.flip-mode > .is-current{opacity:1;pointer-events:auto}

.flip-controls{
  position:fixed;left:0;right:0;bottom:calc(64px + var(--safe-bot));
  z-index:55;display:none;align-items:center;justify-content:center;gap:20px;
  padding:6px;pointer-events:none;
}
.flip-controls.show{display:flex}
.flip-nav{
  pointer-events:auto;width:46px;height:46px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  background:var(--red);color:#fff;border:none;border-radius:50%;
  font-size:26px;line-height:1;cursor:pointer;
  box-shadow:0 6px 18px rgba(109,40,217,.32);
  transition:transform .06s,opacity .15s,background .15s;
}
.flip-nav:active{transform:translateY(1px) scale(.96)}
.flip-nav:disabled{background:var(--surface2);color:var(--text3);box-shadow:none;cursor:default;opacity:.6}
.flip-count{
  pointer-events:auto;min-width:64px;text-align:center;
  background:var(--surface);border:1px solid var(--border);border-radius:20px;
  padding:8px 14px;font-family:var(--font-ui);font-weight:700;
  font-size:13px;color:var(--text);box-shadow:0 4px 14px rgba(26,26,46,.14);
}
.share-mode .flip-controls{bottom:calc(14px + var(--safe-bot))}

/* ── Story starters: theme chips + "Surprise me" that fill the premise box ── */
.spark{ margin-top:10px; }
.spark-lbl{ display:block; font-size:11px; font-weight:700; color:var(--text3); margin-bottom:7px; }
.spark-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.spark-chip{
  font-family:var(--font-ui); font-size:12px; font-weight:700; color:var(--text2);
  background:var(--bg); border:1.5px solid var(--border); border-radius:999px;
  padding:5px 11px; cursor:pointer; line-height:1.2; transition:border-color .15s,color .15s,transform .1s;
}
.spark-chip:hover{ border-color:var(--teal); color:var(--teal); transform:translateY(-1px); }
.spark-chip:active{ transform:translateY(0); }
.spark-surprise{ background:var(--yellow); border-color:var(--text); color:var(--text); }
.spark-surprise:hover{ border-color:var(--text); color:var(--text); filter:brightness(1.04); }


/* ── Desktop Studio framing ── (fine pointers only: a touch device with a wide
   layout viewport must not get a squeezed 680px column of tiny text) */
@media(min-width:760px) and (pointer:fine){
  #create .pad, #settings .settings-pad, #paywall > div, #disclaimer .disc-scroll, #disclaimer .disc-cta {
    max-width:680px;
    margin-left:auto;
    margin-right:auto;
    width:100%;
  }
  #create .topbar, #library .topbar, #settings .topbar, #viewer .topbar, #viewer .viewer-actions, #avatar-preview .topbar, #opening-preview .topbar, #story-preview .topbar {
    max-width:760px;
    margin-left:auto;
    margin-right:auto;
    width:100%;
  }
  #library .scroll > *, #viewer #bookPages, #avatar-preview .av-scroll > *, #opening-preview .op-scroll > *, #story-preview .sp-scroll > * {
    max-width:720px;
    margin-left:auto;
    margin-right:auto;
  }
  .bnav, .av-bottom-bar, .op-bottom-bar, .sp-bottom-bar {
    max-width:720px;
    left:50%;
    right:auto;
    width:100%;
    transform:translateX(-50%);
  }
}

/* ── Editor phase 1: visible selection + clearer bubble tools ── */
.fc-bubble.user-bubble{cursor:grab}
.fc-bubble.bubble-selected{outline:2px solid #C89B3C;outline-offset:3px;box-shadow:0 0 0 5px rgba(109,40,217,.28)}
.fc-bubble.user-bubble:focus-visible{outline:3px solid #6D28D9;outline-offset:3px}
.bt-section-label{font-size:10px;color:#6B5A44;margin:6px 0 3px;font-weight:700;letter-spacing:.6px}
.bt-hint{font-size:10px;color:#6B5A44;margin-top:6px;line-height:1.3}
.bt-btn:disabled{opacity:.45;cursor:default}
.bubble-resize-handle{background:#FFFDF8;border:2px solid #6D28D9}
@media (pointer:coarse){
  .bubble-resize-handle{width:18px;height:18px}
  .bt-btn,.bt-font-btn,.bt-style{min-height:40px;min-width:40px}
}
@media (pointer:coarse){
  .brh-nw,.brh-ne,.brh-n{top:-9px}.brh-sw,.brh-se,.brh-s{bottom:-9px}
  .brh-nw,.brh-sw,.brh-w{left:-9px}.brh-ne,.brh-se,.brh-e{right:-9px}
}

/* ── Create flow UX: numbered steps, large choice cards ── */
.cf-steps{display:flex;gap:6px;flex-wrap:wrap;margin:6px 0 2px}
.cf-steps span{font-size:11px;font-weight:700;color:#6B5A44;background:#FFFDF8;border:1px solid #D4C5A6;border-radius:999px;padding:4px 10px}
.slbl.cf-step{display:flex;align-items:center;gap:9px;font-family:var(--font-display);font-size:1.3rem;letter-spacing:.2px;text-transform:none;color:#593A2E;margin-top:26px;margin-bottom:2px;font-weight:700}
.cf-step-n{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;background:linear-gradient(180deg,#7C3AED,#5B21B6);color:#fff;font-family:var(--font-ui);font-size:13px;border:1px solid rgba(229,197,117,.7);flex-shrink:0}
.cf-step-help{font-size:13px;color:#554A3C;margin:0 0 10px;line-height:1.45}
.add-char-btn{min-height:48px;font-size:14px;color:#593A2E;border-color:rgba(200,155,60,.55);background:rgba(255,253,248,.6)}
.cast-info{font-size:12px;color:#6B5A44}
.spark-chip{min-height:40px}
#formatPickerSection .fmt-scroll{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));overflow:visible;margin:0;padding:0}
#formatPickerSection .fmt-card{position:relative;min-height:128px;padding:16px 14px;border-radius:14px;border:2px solid #D4C5A6;background:#FFFDF8;text-align:left;cursor:pointer;box-shadow:0 6px 18px rgba(38,33,26,.06);transition:transform .12s,border-color .12s,box-shadow .12s}
#formatPickerSection .fmt-card .fe{font-size:34px;margin-bottom:8px}
#formatPickerSection .fmt-card .fn{font-size:15px;color:#26211A}
#formatPickerSection .fmt-card .fd{font-size:12px;color:#554A3C;line-height:1.45}
#formatPickerSection .fmt-card.on{border-color:#6D28D9;background:linear-gradient(180deg,#FFFDF8,#F3ECFF);box-shadow:0 0 0 3px rgba(109,40,217,.18),0 10px 24px rgba(76,29,149,.14)}
#formatPickerSection .fmt-card.on .fn{color:#4C1D95}
#formatPickerSection .fmt-card.on::after,.cf-style-card.on::after{content:'✓';position:absolute;top:8px;right:8px;width:22px;height:22px;border-radius:50%;background:#6D28D9;color:#fff;font-size:13px;font-weight:700;display:flex;align-items:center;justify-content:center}
#formatPickerSection .fmt-card:focus-visible,.cf-style-card:focus-visible{outline:3px solid #C89B3C;outline-offset:2px}
.cf-style-grid{display:none}
.cf-style-grid.cf-ready{display:grid;grid-template-columns:repeat(auto-fill,minmax(104px,1fr));gap:8px;margin-bottom:6px}
.cf-style-group{grid-column:1/-1;font-size:11px;font-weight:700;letter-spacing:.8px;text-transform:uppercase;color:#7C5310;margin-top:8px}
.cf-style-card{position:relative;min-height:84px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:10px 8px;border-radius:12px;border:2px solid #D4C5A6;background:#FFFDF8;font-family:var(--font-ui);font-size:13px;font-weight:700;color:#26211A;cursor:pointer;text-align:center}
.cf-style-icon{font-size:26px;line-height:1}
.cf-style-card.on{border-color:#6D28D9;background:#F3ECFF;color:#4C1D95;box-shadow:0 0 0 3px rgba(109,40,217,.16)}
.cf-hidden-select{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
#create .cost-row{font-size:12px;color:#554A3C}
