/* ============================================================
   Young Author Studio (write/studio.html)
   Builds on assets/css/style.css variables and classes.
   ============================================================ */

.studio-wrap{padding:44px 0 80px}
.studio-title{font-family:var(--serif);font-weight:500;font-size:clamp(32px,4.4vw,48px);line-height:1.15;margin-bottom:10px}
.studio-lede{color:var(--muted);font-size:17.5px;max-width:680px}
.studio-privacy{background:#f6f1e5;border:1px solid var(--line);border-radius:var(--radius);padding:14px 18px;font-size:14.5px;color:#5a4f3e;margin:22px 0 28px;max-width:760px}
.btn-sm{padding:9px 18px;font-size:12.5px}

/* ---------- project bar and step tabs ---------- */
.proj-bar{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px 18px}
.proj-bar-left{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.proj-label{font-size:12.5px;letter-spacing:.1em;text-transform:uppercase;font-weight:600;color:var(--muted)}
.proj-select{padding:9px 12px;border:1px solid var(--line);border-radius:8px;font-size:15px;font-family:var(--sans);background:var(--bg);max-width:280px}
.save-status{font-size:13.5px;color:var(--accent-deep);font-style:italic}
.step-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:20px 0}
.step-tab{font-size:13.5px;letter-spacing:.06em;font-weight:600;padding:11px 22px;border:1px solid var(--line);border-radius:999px;background:var(--surface);cursor:pointer;color:var(--muted)}
.step-tab:hover{color:var(--ink)}
.step-tab.active{background:var(--deep);border-color:var(--deep);color:var(--deep-ink)}

/* ---------- layout ---------- */
.studio-layout{display:grid;grid-template-columns:280px 1fr;gap:26px;align-items:start}
@media(max-width:900px){.studio-layout{grid-template-columns:1fr}}
.studio-side{display:flex;flex-direction:column;gap:18px}
.side-block{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px}
.side-h{font-size:12px;letter-spacing:.22em;text-transform:uppercase;color:var(--accent);font-weight:600;margin-bottom:12px}
.side-book-title{font-family:var(--serif);font-size:20px;font-weight:600;line-height:1.25}
.side-book-meta{font-size:13.5px;color:var(--muted);margin-top:4px;line-height:1.6}
.side-note{font-size:13px;color:var(--muted);font-style:italic}
.page-list{list-style:none}
.page-list li{margin-bottom:2px}
.page-link{display:flex;justify-content:space-between;gap:8px;width:100%;text-align:left;background:none;border:0;border-radius:8px;padding:8px 10px;font-size:14.5px;font-family:var(--sans);color:var(--ink);cursor:pointer}
.page-link:hover{background:#faf6ec}
.page-link.active{background:#f3ead3;font-weight:600}
.page-link .pl-words{font-size:12.5px;color:var(--muted);white-space:nowrap}
.page-link.locked{color:var(--muted);cursor:default}
.page-link.locked:hover{background:none}
.side-stat-row{display:flex;justify-content:space-between;font-size:14px;padding:4px 0;border-bottom:1px solid var(--line-soft)}
.side-stat-row:last-child{border-bottom:0}
.goal-bar{height:10px;background:#efe9da;border-radius:999px;overflow:hidden;margin:10px 0 6px}
.goal-fill{height:100%;background:var(--accent);border-radius:999px;transition:width .3s}
.milestone{font-size:13.5px;color:var(--accent-deep);font-weight:600;margin-top:6px}

/* ---------- panels and forms ---------- */
.studio-main{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:28px 30px;min-height:480px}
@media(max-width:600px){.studio-main{padding:20px 16px}}
.panel-h{font-family:var(--serif);font-size:27px;font-weight:600;margin-bottom:6px}
.panel-sub{color:var(--muted);font-size:15px;margin-bottom:20px;max-width:640px}
.sub-h{font-family:var(--serif);font-size:21px;font-weight:600;margin:30px 0 6px;padding-top:22px;border-top:1px solid var(--line-soft)}
.sub-h:first-of-type{border-top:0;padding-top:0;margin-top:10px}
.sub-note{font-size:14px;color:var(--muted);margin-bottom:14px;max-width:620px}
.f-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 22px}
@media(max-width:700px){.f-grid{grid-template-columns:1fr}}
.field select{width:100%;padding:12px 14px;border:1px solid var(--line);border-radius:8px;font-size:15px;font-family:var(--sans);background:var(--bg)}
.field textarea{min-height:0}
textarea.ta-sm{min-height:64px}
textarea.ta-md{min-height:110px}
.inline-row{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:10px 0}
.small-note{font-size:13px;color:var(--muted)}
.warn-note{background:#fdf3e3;border:1px solid #e8cf9e;border-radius:8px;padding:12px 16px;font-size:14px;color:#6b5320;margin:14px 0}

/* ---------- title helper ---------- */
.title-chips{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
.title-chip{border:1px solid var(--line);background:var(--bg);border-radius:999px;padding:9px 16px;font-size:14.5px;cursor:pointer;font-family:var(--serif);font-size:16px}
.title-chip:hover{border-color:var(--accent)}
.title-chip .star{color:#c9a227;font-weight:700;margin-left:6px}
.title-chip.is-title{border-color:var(--accent);background:#f6f1e5}

/* ---------- character cards ---------- */
.char-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:16px;margin:14px 0}
.char-card{border:1px solid var(--line);border-radius:var(--radius);padding:16px 18px;background:var(--bg)}
.char-card h4{font-family:var(--serif);font-size:19px;margin-bottom:6px}
.char-card p{font-size:13.5px;color:#4a4033;margin-bottom:4px;line-height:1.5}
.char-card p strong{color:var(--ink)}
.char-actions{display:flex;gap:8px;margin-top:10px}
.mini-btn{font-size:12px;letter-spacing:.06em;font-weight:600;text-transform:uppercase;padding:7px 13px;border-radius:7px;border:1px solid var(--line);background:var(--surface);cursor:pointer;color:var(--muted)}
.mini-btn:hover{color:var(--ink);border-color:var(--accent)}
.mini-btn.danger:hover{color:#9c2b1e;border-color:#9c2b1e}

/* ---------- story mountain ---------- */
.mountain{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin:16px 0 6px}
@media(max-width:700px){.mountain{grid-template-columns:1fr}}
.mtn-cell{border-radius:8px;padding:12px;font-size:13px;text-align:center;color:#fff;line-height:1.4}
.mtn-cell strong{display:block;font-size:13.5px;margin-bottom:3px}
.mtn-1{background:#7d9b76}.mtn-2{background:#5d8a94}.mtn-3{background:#b3543f}.mtn-4{background:#5d8a94}.mtn-5{background:#8a6a3c}
.outline-field{margin-bottom:12px}
.outline-field label{display:block;font-size:13px;font-weight:600;letter-spacing:.05em;margin-bottom:5px;color:#4a4033}
.outline-field textarea{width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:8px;font-size:15px;font-family:var(--sans);background:var(--bg);min-height:58px;resize:vertical}

/* ---------- write step ---------- */
.editor-tools{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;margin-bottom:14px}
.editor-tools .field{margin-bottom:0;flex:1;min-width:200px}
.ch-title-input{font-family:"Lora",Georgia,serif;font-size:19px}
.book-editor{width:100%;min-height:430px;padding:26px 30px;border:1px solid var(--line);border-radius:var(--radius);background:#fffef9;font-family:"Lora",Georgia,"Times New Roman",serif;font-size:17.5px;line-height:1.85;color:#2b241c;resize:vertical;box-shadow:inset 0 0 0 1px #fff,0 2px 10px rgba(43,36,28,.05)}
.book-editor:focus{outline:2px solid #e3d5ae;outline-offset:1px}
.editor-stats{display:flex;gap:18px;flex-wrap:wrap;font-size:13.5px;color:var(--muted);margin-top:10px}
.define-box{border:1px solid var(--line);border-radius:var(--radius);background:#f6f1e5;padding:16px 18px;margin-top:16px}
.define-box h4{font-family:var(--serif);font-size:19px;text-transform:capitalize}
.define-box p{font-size:14.5px;color:#4a4033;margin-top:4px}

/* ---------- write step: live marks, tap-a-word popup, stronger words ---------- */
.editor-wrap{position:relative;border:1px solid var(--line);border-radius:var(--radius);background:#fffef9;box-shadow:inset 0 0 0 1px #fff,0 2px 10px rgba(43,36,28,.05);overflow:hidden}
.editor-wrap .book-editor{position:relative;z-index:1;display:block;width:100%;border:0;border-radius:0;box-shadow:none;background:transparent;color:transparent;-webkit-text-fill-color:transparent;caret-color:#2b241c}
.editor-wrap .book-editor:focus{outline:2px solid #e3d5ae;outline-offset:-2px}
.editor-wrap .book-editor::selection{background:rgba(201,162,39,.35)}
.editor-wrap .book-editor::placeholder{color:#a2937a;-webkit-text-fill-color:#a2937a}
.hl-backdrop{position:absolute;inset:0;padding:26px 30px;overflow:hidden;pointer-events:none}
.hl-inner{font-family:"Lora",Georgia,"Times New Roman",serif;font-size:17.5px;line-height:1.85;color:#2b241c;white-space:pre-wrap;overflow-wrap:break-word;will-change:transform}
.hl-spell{text-decoration:underline wavy #c0272d 1.4px;text-underline-offset:3px}
.hl-gram{text-decoration:underline dotted #c0272d 2.4px;text-underline-offset:3px}
.hl-strong{text-decoration:underline dotted #b28d2a 2.4px;text-underline-offset:3px}
.editor-hint{margin-top:9px}
.word-pop{position:fixed;z-index:80;width:330px;max-width:calc(100vw - 20px);max-height:72vh;overflow-y:auto;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 16px 44px rgba(43,36,28,.28);padding:14px 16px 16px}
.word-pop .wp-close{position:absolute;top:6px;right:8px;border:0;background:none;font-size:19px;line-height:1;color:var(--muted);cursor:pointer;padding:6px}
.word-pop .wp-close:hover{color:var(--ink)}
.wp-head{font-size:11.5px;letter-spacing:.14em;text-transform:uppercase;font-weight:700;color:var(--accent-deep);margin-bottom:3px}
.wp-word{font-family:"Lora",Georgia,serif;font-size:18px;font-weight:600;margin-bottom:2px}
.wp-why{font-size:13.5px;color:var(--muted);margin-bottom:9px;line-height:1.5}
.wp-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:6px}
.wp-sec{border-top:1px solid var(--line-soft);margin-top:11px;padding-top:11px}
.wp-sec:first-of-type{border-top:0;margin-top:0;padding-top:0}
.wp-alt{display:flex;flex-direction:column;align-items:flex-start;gap:0;width:100%;text-align:left;border:1px solid var(--line);background:var(--bg);border-radius:8px;padding:8px 12px;margin-bottom:6px;cursor:pointer;font-family:var(--sans)}
.wp-alt:hover{border-color:var(--accent);background:#faf6ec}
.wp-alt strong{font-family:"Lora",Georgia,serif;font-size:16.5px;color:var(--ink);font-weight:600}
.wp-alt span{font-size:12.5px;color:var(--muted);line-height:1.4}
.wp-fix-btn{margin-bottom:4px}

/* ---------- finish step: AI final touch-up ---------- */
.polish-version{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:12px 0}
.polish-version .vp-tag{font-size:13px;font-weight:700;letter-spacing:.05em;padding:7px 13px;border-radius:999px;border:1px solid var(--line);background:#f6f1e5;color:#5a4f3e}
.polish-version .vp-tag.on{background:#eef4e6;border-color:#c4d6ab;color:#3f6124}
.polish-review{border:1px solid var(--line);border-radius:var(--radius);margin:14px 0;overflow:hidden}
.polish-review-head{background:#faf6ec;padding:12px 18px;font-family:var(--serif);font-size:18px;font-weight:600;border-bottom:1px solid var(--line-soft)}
.polish-ch{padding:12px 18px;border-bottom:1px solid var(--line-soft)}
.polish-ch:last-child{border-bottom:0}
.polish-ch h5{font-family:var(--serif);font-size:17px;margin-bottom:8px}
.polish-pair{margin-bottom:10px}
.polish-pair .pp-label{font-size:11.5px;letter-spacing:.12em;text-transform:uppercase;font-weight:700;margin-bottom:3px}
.polish-before .pp-label{color:#9c2b1e}
.polish-after .pp-label{color:#3f6124}
.polish-pair p{font-family:"Lora",Georgia,serif;font-size:14.5px;line-height:1.6;border-radius:8px;padding:9px 12px;white-space:pre-wrap}
.polish-before p{background:#fdf0ec}
.polish-after p{background:#eef4e6}
.polish-same{font-size:14px;color:var(--muted);padding:10px 18px}
.progress-note{font-size:14px;color:var(--accent-deep);font-style:italic;margin:8px 0}

/* ---------- check step ---------- */
.check-summary{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0}
.check-badge{background:#f6f1e5;border:1px solid var(--line);border-radius:999px;padding:7px 15px;font-size:13.5px;font-weight:600;color:#5a4f3e}
.check-badge.good{background:#eef4e6;border-color:#c4d6ab;color:#3f6124}
.check-group{border:1px solid var(--line);border-radius:var(--radius);margin-bottom:18px;overflow:hidden}
.check-group-head{background:#faf6ec;padding:12px 18px;font-family:var(--serif);font-size:18px;font-weight:600;border-bottom:1px solid var(--line-soft);display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.check-item{padding:12px 18px;border-bottom:1px solid var(--line-soft);font-size:14.5px}
.check-item:last-child{border-bottom:0}
.check-item .ci-kind{font-size:11.5px;letter-spacing:.14em;text-transform:uppercase;font-weight:700;color:var(--accent-deep)}
.check-item .ci-quote{font-family:"Lora",Georgia,serif;background:#faf6ec;border-radius:6px;padding:3px 8px}
.check-item .ci-why{color:var(--muted);font-size:13.5px;margin-top:3px}
.check-item .ci-actions{margin-top:8px;display:flex;gap:8px;flex-wrap:wrap}
.check-clean{padding:14px 18px;font-size:15px;color:#3f6124}
.overuse-table{width:100%;border-collapse:collapse;font-size:14.5px}
.overuse-table td{padding:7px 10px;border-bottom:1px solid var(--line-soft)}
.overuse-table td:first-child{font-family:"Lora",Georgia,serif;font-weight:600}

/* ---------- design step ---------- */
.design-grid{display:grid;grid-template-columns:1fr 1fr;gap:26px;align-items:start}
@media(max-width:980px){.design-grid{grid-template-columns:1fr}}
.cover-preview-box{background:#efe9da;border:1px solid var(--line);border-radius:var(--radius);padding:16px;text-align:center}
.cover-preview-box h4{font-family:var(--serif);font-size:18px;margin-bottom:10px}
.cover-preview-box canvas{max-width:100%;height:auto;border:1px solid #d8cdb2;box-shadow:0 8px 22px rgba(43,36,28,.18);background:#fff}
.bg-swatches{display:grid;grid-template-columns:repeat(auto-fill,minmax(74px,1fr));gap:8px;margin:8px 0 14px}
.bg-swatch{height:52px;border-radius:8px;border:2px solid var(--line);cursor:pointer;padding:0;overflow:hidden;background-size:cover;background-position:center}
.bg-swatch.active{border-color:var(--accent);box-shadow:0 0 0 2px #e3d5ae}
input[type="color"].color-input{width:56px;height:40px;padding:2px;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer}
.draw-wrap{border:1px solid var(--line);border-radius:var(--radius);background:#efe9da;padding:14px;text-align:center}
#draw-pad{background:#fff;border:1px solid #d8cdb2;border-radius:6px;max-width:100%;touch-action:none;cursor:crosshair}
.draw-tools{display:flex;gap:8px;flex-wrap:wrap;justify-content:center;margin:12px 0 4px}
.art-thumb{display:inline-block;margin:6px;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#fff;text-align:center}
.art-thumb img{width:120px;height:90px;object-fit:contain}
.art-thumb .mini-btn{margin:6px}
.prompt-list{list-style:none}
.prompt-list li{padding:8px 0 8px 22px;position:relative;border-bottom:1px solid var(--line-soft);font-size:14.5px}
.prompt-list li::before{content:"\00B7";position:absolute;left:2px;color:var(--accent);font-weight:700}

/* ---------- finish step: book preview ---------- */
.book-preview{display:flex;flex-direction:column;align-items:center;gap:22px;margin:20px 0}
.bp-page{background:#fff;color:#221d16;border:1px solid #ddd3ba;box-shadow:0 8px 26px rgba(43,36,28,.12);padding:52px 48px;font-family:"Lora",Georgia,serif;width:100%}
@media(max-width:600px){.bp-page{padding:34px 22px}}
.bp-page p{font-size:16.5px;line-height:1.8;margin-bottom:14px;text-indent:1.6em}
.bp-page p.no-indent{text-indent:0}
.bp-cover-page{padding:0;border:0;box-shadow:0 8px 26px rgba(43,36,28,.2);background:none}
.bp-cover-page img{width:100%;display:block}
.bp-title-page{text-align:center;padding-top:110px;padding-bottom:110px}
.bp-title-page h2{font-family:"Playfair Display",Georgia,serif;font-size:34px;line-height:1.25;margin-bottom:20px}
.bp-title-page .bp-byline{font-size:16px;letter-spacing:.18em;text-transform:uppercase;color:#5a4f3e}
.bp-title-page .bp-pub{margin-top:90px;font-size:13.5px;color:#6f6557}
.bp-small-page{text-align:center;padding-top:90px;padding-bottom:90px}
.bp-small-page p{text-indent:0;font-size:15px}
.bp-copyright{text-align:left}
.bp-copyright p{text-indent:0;font-size:13.5px;line-height:1.7}
.bp-toc h3,.bp-chapter h3{font-family:"Playfair Display",Georgia,serif;text-align:center;font-size:24px;margin-bottom:26px}
.bp-toc ul{list-style:none}
.bp-toc li{font-size:16px;padding:7px 0;border-bottom:1px dotted #cfc2a2;display:flex;justify-content:space-between}
.bp-chapter h3{font-size:23px}
.bp-chapter .bp-chapnum{text-align:center;font-size:12.5px;letter-spacing:.26em;text-transform:uppercase;color:#8a6a3c;margin-bottom:8px}
.bp-art{text-align:center;margin:6px 0 20px}
.bp-art img{max-width:100%;max-height:420px;margin:0 auto;border-radius:4px}
.bp-end{text-align:center;padding-top:120px;padding-bottom:120px}
.bp-end .the-end{font-family:"Playfair Display",Georgia,serif;font-size:30px;letter-spacing:.14em}
.finish-actions{display:flex;gap:12px;flex-wrap:wrap;margin:18px 0}
.status-panel{border:1px solid var(--line);border-radius:var(--radius);padding:20px 22px;background:#f6f1e5;margin:16px 0}
.status-panel h4{font-family:var(--serif);font-size:20px;margin-bottom:6px}
.kdp-steps{list-style:none;counter-reset:step}
.kdp-steps li{counter-increment:step;padding:10px 0 10px 42px;position:relative;border-bottom:1px solid var(--line-soft);font-size:15px}
.kdp-steps li::before{content:counter(step);position:absolute;left:0;top:10px;width:27px;height:27px;border:1px solid var(--accent);border-radius:50%;color:var(--accent-deep);font-size:13px;font-weight:600;display:flex;align-items:center;justify-content:center}
.check-line{display:flex;gap:10px;align-items:flex-start;font-size:15px;margin:10px 0;cursor:pointer}
.check-line input{margin-top:4px;width:18px;height:18px}

/* ---------- certificate (mirrors learn.css certificate) ---------- */
.ya-cert-tools{display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:center;margin:0 0 18px}
.cert-sheet{background:#fffdf6;border:3px double #b8860b;border-radius:6px;max-width:680px;margin:0 auto;padding:38px 42px;text-align:center;color:#2c2416;box-shadow:0 6px 24px rgba(0,0,0,.12);position:relative}
.cert-sheet:before{content:"";position:absolute;inset:8px;border:1px solid #d4af37;border-radius:3px;pointer-events:none}
.cert-brand{font-size:13px;letter-spacing:3px;text-transform:uppercase;color:#8a6d1c;margin-bottom:6px}
.cert-title{font-family:Georgia,"Times New Roman",serif;font-size:33px;color:#3d2f0e;margin:0 0 4px}
.cert-rule{width:120px;height:3px;background:linear-gradient(90deg,#b8860b,#e8c766,#b8860b);margin:10px auto 16px}
.cert-present{font-size:14px;color:#6b5b3a;margin:0 0 6px}
.cert-name{font-family:"Brush Script MT","Segoe Script",cursive;font-size:40px;color:#1f3a5f;border-bottom:2px solid #b8860b;display:inline-block;min-width:60%;padding:0 12px 2px;margin-bottom:8px;min-height:52px}
.cert-for{font-size:14px;color:#6b5b3a;margin:0 0 6px}
.cert-book{font-family:Georgia,serif;font-size:22px;font-weight:700;color:#3d2f0e}
.cert-meta{display:flex;justify-content:center;gap:32px;margin:18px 0 6px;font-size:14px;color:#4a3d20;flex-wrap:wrap}
.cert-foot{display:flex;justify-content:space-between;align-items:flex-end;margin-top:26px;gap:16px}
.cert-sign{font-size:12px;color:#6b5b3a;text-align:center;min-width:160px}
.cert-line{display:block;border-bottom:1px solid #8a6d1c;margin-bottom:4px;height:24px}
.cert-verse{font-size:12.5px;font-style:italic;color:#6b5b3a;text-align:right;max-width:60%}

/* ---------- print roots (screen) ---------- */
#book-print-root,#cert-print-root{display:none}

/* ---------- print: whole book (KDP friendly) ---------- */
@page book{size:6in 9in;margin:0.6in 0.5in 0.6in 0.75in}
@page book:left{margin:0.6in 0.75in 0.6in 0.5in}
@page cert{size:letter landscape;margin:0.5in}
@media print{
  body.printing-book .site-header,body.printing-book .site-footer,body.printing-book main,body.printing-book #bundle-bar{display:none!important}
  body.printing-book #book-print-root{display:block}
  body.printing-book .bp-page{page:book;page-break-after:always;box-shadow:none;border:0;width:auto;padding:0;font-family:"Lora",Georgia,serif}
  body.printing-book .bp-page:last-child{page-break-after:auto}
  body.printing-book .bp-cover-page{padding:0}
  body.printing-book .bp-cover-page img{width:100%}
  body.printing-book .bp-pagenum{position:fixed;bottom:0;left:0;right:0;text-align:center;font-family:Georgia,serif;font-size:10pt;color:#444}
  body.printing-cert .site-header,body.printing-cert .site-footer,body.printing-cert main,body.printing-cert #bundle-bar{display:none!important}
  body.printing-cert #cert-print-root{display:block}
  body.printing-cert .cert-sheet{page:cert;box-shadow:none;max-width:none}
}
