/* Asterisk — CAIO Sketch Studio */

:root{
  --serif:"Iowan Old Style","Palatino Linotype",Palatino,"Times New Roman",Georgia,serif;
  --sans:"Avenir Next",Avenir,"Helvetica Neue",Helvetica,Arial,sans-serif;
  --hand:"Chalkboard SE","Comic Sans MS","Segoe Print","Bradley Hand",cursive;

  --paper:#F2EFE6;
  --card:#FBF9F2;
  --card-2:#F4F1E8;
  --ink:#201D18;
  --ink-soft:rgba(32,29,24,.62);
  --line:rgba(32,29,24,.85);
  --line-soft:rgba(32,29,24,.16);
  --coral:#D97757;
  --coral-soft:#F0D3C6;
  --shadow:0 2px 0 rgba(32,29,24,.10), 0 12px 28px -14px rgba(32,29,24,.28);
  --radius:13px;
}
body.dark{
  --paper:#23211C;
  --card:#2C2924;
  --card-2:#262420;
  --ink:#ECE7DA;
  --ink-soft:rgba(236,231,218,.6);
  --line:rgba(236,231,218,.85);
  --line-soft:rgba(236,231,218,.14);
  --coral:#D97757;
  --coral-soft:#5C4030;
  --shadow:0 2px 0 rgba(0,0,0,.25), 0 14px 30px -14px rgba(0,0,0,.6);
}

*{box-sizing:border-box; margin:0; padding:0;}
html,body{height:100%; overflow:hidden; overscroll-behavior:none;}
body{font-family:var(--sans); color:var(--ink); background:var(--paper);
  -webkit-font-smoothing:antialiased; touch-action:none;}

#board{position:fixed; inset:0; width:100vw; height:100vh; display:block; cursor:default;
  user-select:none; -webkit-user-select:none; -webkit-touch-callout:none;}
#board.tool-hand{cursor:grab;} #board.panning{cursor:grabbing;}
#board.tool-draw,#board.tool-rect,#board.tool-ellipse,#board.tool-diamond,
#board.tool-chip,#board.tool-icon,#board.tool-arrow,#board.tool-line{cursor:crosshair;}
#board.tool-text{cursor:text;}

#ui{position:fixed; inset:0; pointer-events:none; z-index:10;}
#ui .island{pointer-events:auto;}

/* ── islands ─────────────────────────────────────── */
.island{
  position:absolute;
  background:var(--card);
  border:1.5px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  display:flex; align-items:center; gap:2px;
  padding:5px;
}

.brand{top:14px; left:14px; padding:5px 6px 5px 12px; gap:9px;}
.brand .mark{display:flex; align-items:center; transform:rotate(-4deg);}
.brandtext{display:flex; flex-direction:column; line-height:1.08; gap:1px;}
.brand .motto{
  font-size:9.5px; font-weight:500; letter-spacing:.25px;
  color:var(--ink-soft); font-style:normal;
}
.brand .name{font-family:var(--serif); font-style:italic; font-weight:600;
  font-size:19px; letter-spacing:.2px; padding-right:2px; user-select:none;}

.toolbar{top:14px; left:50%; transform:translateX(-50%); z-index:15;}
@media (max-width:1180px){ .toolbar{top:72px;} }

.quick{top:14px; right:14px;}
.zoombar{bottom:14px; left:14px;}

.sep{width:1.5px; align-self:stretch; margin:4px 5px; background:var(--line-soft); border-radius:2px;}

/* ── buttons ─────────────────────────────────────── */
button{font-family:inherit; color:inherit; background:none; border:none; cursor:pointer;}
.toolbtn,.iconbtn{
  width:38px; height:38px; border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  transition:background .12s, transform .06s;
}
.toolbtn:hover,.iconbtn:hover{background:var(--card-2);}
.toolbtn:active,.iconbtn:active{transform:scale(.93);}
.toolbtn svg,.iconbtn svg{width:21px; height:21px; overflow:visible;
  fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;}
.toolbtn svg.filled g{fill:currentColor; stroke:none;}
.toolbtn.active{background:var(--coral); color:#FBF6EE;}
.toolbtn.active:hover{background:var(--coral);}
.togglebtn.on{background:var(--coral-soft); color:var(--ink);}
.iconbtn:disabled{opacity:.3; cursor:default;}
.iconbtn:disabled:hover{background:none;}
svg .halffill{fill:none;}
.themeHalf{fill:currentColor;}

.pill{
  font-family:var(--sans); font-weight:600; font-size:13px; letter-spacing:.3px;
  background:var(--coral); color:#FBF6EE; border-radius:9px;
  padding:9px 13px; margin:0 2px;
  transition:transform .06s, filter .12s;
}
.pill:hover{filter:brightness(1.06);}
.pill:active{transform:scale(.95);}

/* ── file menu ───────────────────────────────────── */
.menu{
  position:absolute; top:calc(100% + 8px); left:0; min-width:225px;
  background:var(--card); border:1.5px solid var(--line); border-radius:12px;
  box-shadow:var(--shadow); padding:6px; display:flex; flex-direction:column; z-index:30;
}
.menu button{
  text-align:left; font-size:13.5px; font-weight:500; padding:9px 11px; border-radius:8px;
}
.menu button:hover{background:var(--card-2);}
.menu button.danger{color:#B3402A;}
body.dark .menu button.danger{color:#F09070;}
.menu hr{border:none; border-top:1.5px solid var(--line-soft); margin:5px 8px;}
.menu.right{left:auto; right:0;}
.menu.up{top:auto; bottom:calc(100% + 8px); min-width:250px; max-height:62vh; overflow-y:auto;}
.menu .menuhead, .iconmenu .menuhead, .tpldialog .menuhead, .snapdialog .menuhead{
  font-size:10.5px; font-weight:800; letter-spacing:1.1px; text-transform:uppercase;
  color:var(--coral); padding:8px 11px 3px;
}
.menu button .dim{color:var(--ink-soft); font-weight:500; font-size:12px; float:right; margin-left:14px;
  font-variant-numeric:tabular-nums;}
.menu button.sel{background:var(--coral-soft);}

.boardlabel{
  font-size:12.5px; font-weight:600; height:38px; border-radius:9px; padding:0 11px;
  font-variant-numeric:tabular-nums; white-space:nowrap;
  display:inline-flex; align-items:center; gap:6px;
}
.boardlabel svg{
  width:15px; height:15px; flex:0 0 auto;
  stroke:currentColor; fill:none; stroke-width:1.6; stroke-linecap:round;
}
.boardlabel:hover{background:var(--card-2);}

#gridMenu{min-width:190px; padding:8px;}
#gridMenu .gridseg{display:flex; gap:4px; padding:2px 3px 4px;}
#gridMenu .gridseg button{
  flex:1; height:30px; border-radius:8px; border:1.5px solid var(--line-soft);
  font-size:12.5px; font-weight:600; padding:0;
  text-align:center;
}
#gridMenu .gridseg button:hover{background:var(--card-2);}
#gridMenu .gridseg button.sel{background:var(--coral); color:#FBF6EE; border-color:var(--coral);}
#gridSizeRange{width:calc(100% - 16px); margin:2px 8px 8px; accent-color:var(--coral);}

#ctxMenu{z-index:50; min-width:190px;}

.paperbtn{position:relative;}
.paperdot{
  width:19px; height:19px; border-radius:50%;
  border:1.5px solid var(--line); background:var(--paper);
  pointer-events:none;
}
.paperpop{flex-direction:column; align-items:stretch; width:206px;}
.paperscope{margin-bottom:2px;}
.paperscope button{flex:1;}
.paperswatches{display:flex; flex-wrap:wrap; gap:7px;}
.paperswatches button{
  width:24px; height:24px; border-radius:8px; padding:0;
  border:1.5px solid var(--line-soft); cursor:pointer;
}
.paperswatches button.picked{
  border-color:var(--coral);
  box-shadow:0 0 0 2px var(--coral) inset, 0 0 0 1.5px var(--paper) inset;
}
.paperrow{display:flex; gap:8px; align-items:center;}
#paperInput{width:38px; height:32px; padding:0; border:none; background:none; cursor:pointer;}
#paperHex{
  flex:1; font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:13px;
  padding:6px 8px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); min-width:0;
}

/* ── style panel ─────────────────────────────────── */
.stylePanel{
  top:76px; left:14px; width:212px;
  flex-direction:column; align-items:stretch; gap:9px;
  padding:13px 13px 11px;
  max-height:calc(100vh - 170px); overflow-y:auto;
}
.stylePanel .row{display:flex; flex-direction:column; gap:5px;}
.stylePanel label{
  font-size:10.5px; font-weight:700; letter-spacing:1.1px; text-transform:uppercase;
  color:var(--ink-soft);
}
.swatches{display:flex; flex-wrap:wrap; gap:5px;}
.swatch{
  width:24px; height:24px; border-radius:7px;
  border:1.5px solid var(--line-soft);
  position:relative; transition:transform .08s;
}
.swatch:hover{transform:scale(1.12);}
.swatch.sel{border-color:var(--coral); box-shadow:0 0 0 2px var(--coral-soft);}
.swatch.tauto{
  background:transparent !important; color:var(--ink);
  font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center;
  font-family:var(--serif); font-style:italic;
}
.swatch.none{
  background:
    linear-gradient(45deg, transparent 44%, #C25F43 44%, #C25F43 56%, transparent 56%),
    var(--card);
}
.swatch.custom{
  background:conic-gradient(#D97757,#EEDFA9,#C4D4C4,#93A2E4,#C08FAD,#D97757);
  overflow:hidden;
}
.swatch.custom input{position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%;}
.swatch.custom.picked{background:var(--picked, #D97757);}

.fontbtn{
  font-family:var(--sans); font-size:13px; font-weight:500; color:var(--ink);
  background:var(--card-2); border:1.5px solid var(--line-soft); border-radius:8px;
  padding:7px 9px; width:100%; cursor:pointer; outline:none;
  display:flex; align-items:center; gap:6px; text-align:left;
}
.fontbtn:hover{border-color:var(--line);}
.fontbtn #fontBtnLabel{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.fontcaret{font-size:9px; opacity:.5;}
.fontmenu{
  position:fixed; z-index:60; width:228px;
  overflow-y:auto; overscroll-behavior:contain;
}
.fontmenu button{font-size:14.5px; padding:7px 11px;}
.fontmenu button.sel{background:var(--coral-soft);}
.headrow{display:flex; flex-direction:column; gap:5px;}
.headrow select{width:100%;}

.iconmenu{
  position:absolute; top:calc(100% + 8px); left:50%; transform:translateX(-50%);
  background:var(--card); border:1.5px solid var(--line); border-radius:12px;
  box-shadow:var(--shadow); padding:7px; z-index:30;
  display:grid; grid-template-columns:repeat(5, 40px); gap:3px;
}
.iconmenu button{
  width:40px; height:40px; border-radius:9px;
  display:flex; align-items:center; justify-content:center;
  transition:background .1s;
}
.iconmenu button:hover{background:var(--card-2);}
.iconmenu button.sel{background:var(--coral); color:#FBF6EE;}
.iconmenu svg{width:22px; height:22px; overflow:visible; fill:none; stroke:currentColor;
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;}
.iconmenu svg .fillme{fill:currentColor; stroke:none;}
.iconmenu .menuhead{grid-column:1 / -1; margin-top:4px; padding:8px 2px 2px;}
.mipager{
  grid-column:1 / -1; display:flex; align-items:center; justify-content:center;
  gap:8px; padding-top:2px;
}
.mipager button{
  width:30px; height:26px; border-radius:8px; font-size:15px; line-height:1;
  border:1.5px solid var(--line-soft);
}
.mipager button:hover{background:var(--card-2);}
.mipager button:disabled{opacity:.3;}
.mipager span{font-size:11.5px; color:var(--ink-soft); min-width:56px; text-align:center;
  font-variant-numeric:tabular-nums;}
.assetmenu{display:flex; flex-direction:column; width:248px; gap:7px; padding:10px;}
.assetmenu .menuhead{margin-top:0; padding:0 2px 2px;}
#assetGrid{display:grid; grid-template-columns:repeat(4, 1fr); gap:6px;}
#assetGrid button{
  height:52px; border-radius:9px; border:1.5px solid var(--line-soft);
  display:flex; align-items:center; justify-content:center; overflow:hidden;
  background:
    repeating-conic-gradient(var(--card-2) 0% 25%, var(--card) 0% 50%) 0 0 / 14px 14px;
}
#assetGrid button:hover{border-color:var(--coral);}
#assetGrid img{max-width:88%; max-height:88%; object-fit:contain; pointer-events:none;}
.assethint{font-size:10.5px; color:var(--ink-soft); line-height:1.45; padding:0 2px;}
.assetmenu #assetAddBtn{
  width:auto; height:auto; align-self:flex-start; white-space:nowrap;
  padding:8px 14px; border:1.5px solid var(--line-soft); border-radius:9px;
  font-size:12.5px; font-weight:600;
}
.assetmenu #assetAddBtn:hover{background:var(--card-2); border-color:var(--coral);}
#miSearch{
  grid-column:1 / -1; box-sizing:border-box; margin:2px 0 3px;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:9px;
  background:var(--card); color:var(--ink); font-size:12.5px;
}
#miSearch:focus{outline:none; border-color:var(--coral);}
#miGrid{grid-column:1 / -1; display:grid; grid-template-columns:repeat(3, 1fr); gap:4px;}
#miGrid button{
  height:38px; border-radius:9px; border:1.5px solid transparent;
  display:flex; align-items:center; justify-content:center;
  position:relative;
}
#miGrid button.pin::after{
  content:'★'; position:absolute; top:0px; right:3px;
  font-size:9px; color:var(--coral);
}
#miGrid button.sel.pin::after{color:#FBF6EE;}
#miGrid button:hover{background:var(--card-2);}
#miGrid button.sel{background:var(--coral); color:#FBF6EE;}
#miGrid svg{width:22px; height:22px; fill:currentColor; stroke:none;}

.segment{display:flex; gap:4px; flex-wrap:wrap;}
.segment button{
  min-width:30px; height:30px; padding:0 7px; border-radius:8px;
  border:1.5px solid var(--line-soft);
  display:flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:600;
  transition:background .1s;
}
.segment button:hover{background:var(--card-2);}
.segment button.sel{background:var(--ink); color:var(--paper); border-color:var(--ink);}
.segment button:disabled{opacity:.35; cursor:default;}
.segment button:disabled:hover{background:none;}
.menu button:disabled{opacity:.4; cursor:default;}
.segment svg{width:19px; height:19px; overflow:visible; fill:none; stroke:currentColor;
  stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;}
.segment svg .solidfill{fill:currentColor; stroke:none;}
.fsample{font-size:15px; line-height:1;}
.fsample.serif{font-family:var(--serif);}
.fsample.sans{font-family:var(--sans); font-weight:600;}
.fsample.hand{font-family:var(--hand);}

#opacityRange{width:100%; accent-color:var(--coral); height:22px;}

.adjrow{display:flex; align-items:center; gap:7px;}
.typorow{align-items:flex-start;}
.typosliders{flex:1; display:flex; flex-direction:column; gap:7px; min-width:0;}
.tyrow{display:flex; flex-direction:column; gap:1px;}
.tyhead{display:flex; justify-content:space-between; align-items:baseline;}
.tyhead span{font-size:11px; color:var(--ink-soft);}
.tyhead b{
  font-size:12px; font-variant-numeric:tabular-nums; color:var(--ink);
}
.tyrow input{width:100%; accent-color:var(--coral); height:18px;}
.tyreset{margin-top:2px;}
.richwrap{flex:1; display:flex; flex-direction:column; gap:6px; min-width:0;}
.richseg button{width:34px;}
.richseg b{font-weight:800;}
.hlrow{display:flex; gap:5px; align-items:center;}
.hldot{
  width:20px; height:20px; border-radius:6px;
  border:1.5px solid var(--line-soft); padding:0;
}
.hldot:hover{transform:scale(1.12);}
.hldot.hlcustom{
  background:conic-gradient(#e5484d,#e6b400,#30a46c,#0091ff,#8e4ec6,#e5484d);
}
.hldot.hloff{
  background:var(--card); font-size:10px; color:var(--ink-soft);
  display:flex; align-items:center; justify-content:center;
}
.adjrow span{
  font-size:10.5px; font-weight:600; color:var(--ink-soft); width:52px; flex-shrink:0;
}
.adjrow input{flex:1; accent-color:var(--coral); height:18px; min-width:0;}

.row.actions{flex-direction:row; flex-wrap:wrap; gap:6px; margin-top:2px;}
.minipill{
  flex:1 1 40%; font-size:12.5px; font-weight:600; padding:8px 0; border-radius:8px;
  border:1.5px solid var(--line-soft);
}
.minipill:hover{background:var(--card-2);}
.minipill.danger{color:#B3402A; border-color:rgba(179,64,42,.4);}
body.dark .minipill.danger{color:#F09070; border-color:rgba(240,144,112,.4);}

/* ── zoom bar ────────────────────────────────────── */
.zoombar .zoomlabel{
  font-size:12.5px; font-weight:600; min-width:52px; height:38px; border-radius:9px;
  font-variant-numeric:tabular-nums;
}
.zoombar .zoomlabel:hover{background:var(--card-2);}

/* ── hint + shortcuts ───────────────────────────── */
/* ── page strip ─────────────────────────────────── */
.pagestrip{
  bottom:14px; left:50%; transform:translateX(-50%);
  gap:6px; padding:6px; max-width:62vw; overflow-x:auto;
}
.pagethumb{
  position:relative; border-radius:8px; overflow:hidden;
  border:2px solid var(--line-soft); padding:0; display:flex;
  transition:border-color .12s, transform .08s;
}
.pagethumb:hover{transform:translateY(-2px);}
.pagethumb.active{border-color:var(--coral); box-shadow:0 0 0 2px var(--coral-soft);}
.pagethumb canvas{display:block;}
.pagenum{
  position:absolute; bottom:2px; left:4px; font-size:9.5px; font-weight:700;
  color:var(--ink-soft); background:color-mix(in srgb, var(--card) 80%, transparent);
  padding:0 4px; border-radius:5px; pointer-events:none;
}
.pageadd{
  width:36px; align-self:stretch; border-radius:8px;
  border:1.5px dashed var(--line-soft);
  font-size:19px; font-weight:500; color:var(--ink-soft);
}
.pageadd:hover{background:var(--card-2); color:var(--ink);}

/* ── PDF dialog ─────────────────────────────────── */
.pdfdialog{
  top:50%; left:50%; transform:translate(-50%,-50%);
  flex-direction:column; align-items:stretch; gap:10px;
  padding:18px 20px 14px; width:300px; z-index:60;
}
.pdfdialog h3{font-family:var(--serif); font-style:italic; font-size:18px;}
.pdfdialog p{font-size:12.5px; color:var(--ink-soft);}
#pdfPageList{display:flex; flex-direction:column; gap:6px; max-height:40vh; overflow-y:auto;}
#pdfPageList label{
  display:flex; align-items:center; gap:8px; font-size:13.5px; font-weight:500;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:8px; cursor:pointer;
}
#pdfPageList label:hover{background:var(--card-2);}
#pdfPageList input{accent-color:var(--coral); width:15px; height:15px;}

.tpldialog{width:390px;}
#tplList{display:flex; flex-direction:column; gap:7px; max-height:46vh; overflow-y:auto;}
.tplrow{
  display:flex; align-items:center; gap:8px;
  padding:9px 10px; border:1.5px solid var(--line-soft); border-radius:9px;
}
.tplinfo{flex:1; display:flex; flex-direction:column; gap:2px; min-width:0;}
.tplinfo b{font-size:13.5px;}
.tplinfo span{font-size:11.5px; color:var(--ink-soft); line-height:1.35;}
.tplrow .minipill{flex:0 0 auto; padding:7px 13px;}
.tplrow .tplmini{padding:7px 9px; min-width:30px;}
.tplrow .tpldel{padding:7px 10px;}
.tpldialog .actions{flex-wrap:wrap; gap:6px;}
#tplList .menuhead{padding:6px 2px 1px;}
#tplList .menuhead:first-child{padding-top:0;}
.tplcathead{
  display:flex; align-items:center; justify-content:space-between;
  width:100%; text-align:left; cursor:pointer; border-radius:7px;
}
.tplcathead:hover{background:var(--card-2);}
.tplcathead .tplcatmeta{
  font-size:10.5px; font-weight:700; letter-spacing:.6px;
  color:var(--ink-soft); text-transform:none;
}
.tplcathead.folded{opacity:.75;}
.tplinfo b .star{color:var(--coral);}
.tplsave{
  margin-top:10px; padding-top:10px; border-top:1.5px solid var(--line-soft);
  display:flex; flex-direction:column; gap:7px;
}
.tplsave .menuhead{padding:0 2px;}
.tplsaverow{display:flex; gap:7px;}
.tplsaverow input, .tplsaverow select{
  font-family:var(--sans); font-size:13px; font-weight:500;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); min-width:0;
}
.tplsaverow input{flex:1;}
.tplsaverow select{flex:0 0 auto; max-width:45%; cursor:pointer;}
.tplsaverow input:focus, .tplsaverow select:focus{outline:none; border-color:var(--coral);}
/* standard dialog action rows: auto-width buttons, right-aligned */
.tpldialog .row.actions, .pdfdialog .row.actions{display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:2px;}
.tpldialog .row.actions .minipill, .pdfdialog .row.actions .minipill{flex:0 0 auto; padding:8px 14px;}
.tpldialog .row.actions .pill, .pdfdialog .row.actions .pill{flex:0 0 auto; font-size:12.5px; padding:8px 16px; margin:0;}
.tplfoot{margin-top:8px; padding-top:9px; border-top:1.5px solid var(--line-soft);}

/* ── chart & table dialog ───────────────────────── */
.chartdialog{width:440px;}
.chartseg{display:flex; flex-wrap:wrap; gap:4px; margin-bottom:8px;}
.chartseg button{
  flex:1 1 auto; font-size:12.5px; font-weight:600; padding:7px 10px;
  border:1.5px solid var(--line-soft); border-radius:8px; white-space:nowrap;
}
.chartseg button:hover{background:var(--card-2);}
.chartseg button.sel{background:var(--coral); color:#FBF6EE; border-color:var(--coral);}
.chartintro{font-size:12px; color:var(--ink-soft); line-height:1.45; margin:2px 0 8px;}
#chartData{
  width:100%; resize:vertical; min-height:96px;
  font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:12.5px; line-height:1.5;
  padding:8px 10px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); tab-size:10;
}
#chartData:focus{outline:none; border-color:var(--coral);}
.chartmeta{margin-top:7px;}
.chartmeta input{flex:1;}
.chartopts{gap:16px;}
.chartcheck{
  display:flex; align-items:center; gap:6px; flex:0 0 auto;
  font-size:12.5px; font-weight:600; color:var(--ink); cursor:pointer;
}
.chartcheck input{accent-color:var(--coral); width:15px; height:15px; flex:0 0 auto;}
.chartoptlabel{
  flex:0 0 auto; font-size:10.5px; font-weight:800; letter-spacing:1px;
  text-transform:uppercase; color:var(--coral); width:38px;
}
.chartopts{align-items:center;}
.chartminiseg{display:flex; gap:3px; flex:0 0 auto;}
.chartminiseg button{
  font-size:11px; font-weight:600; padding:5px 9px;
  border:1.5px solid var(--line-soft); border-radius:7px;
}
.chartminiseg button:hover{background:var(--card-2);}
.chartminiseg button.sel{background:var(--coral); color:#FBF6EE; border-color:var(--coral);}

/* prompt recipes + snapshots */
.reciperow{display:flex; flex-wrap:wrap; gap:6px;}
.reciperow .minipill{flex:0 0 auto; padding:7px 12px;}
.snapdialog{width:400px;}
#snapList{display:flex; flex-direction:column; gap:7px; max-height:40vh; overflow-y:auto;}
.snapdialog .row.actions{display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:2px;}
.snapdialog .row.actions .minipill{flex:0 0 auto; padding:8px 14px;}
.snapdialog .row.actions .pill{flex:0 0 auto; font-size:12.5px; padding:8px 16px; margin:0;}
.snapempty{font-size:12.5px; color:var(--ink-soft); line-height:1.5;}
/* time-lapse bar */
.tlbar{
  bottom:88px; left:50%; transform:translateX(-50%);
  max-width:min(96vw, 1100px); padding:7px 9px; gap:6px; z-index:20;
  flex-direction:column; align-items:stretch;
}
.tlrow{display:flex; align-items:center; gap:7px; min-width:0;}
.tllab{font-size:11px; font-weight:700; color:var(--ink-soft); flex:0 0 auto;}
.tlfade{
  display:flex; align-items:center; gap:5px; font-size:12px; font-weight:600;
  color:var(--ink); flex:0 0 auto; cursor:pointer; white-space:nowrap;
}
.tlfade input{accent-color:var(--coral); width:14px; height:14px;}
.tlbtn.on{background:var(--coral); border-color:var(--coral); color:#fff;}
.tlprog{
  flex:1; min-width:40px; height:7px; border-radius:4px; overflow:hidden;
  background:var(--card-2); border:1px solid var(--line-soft);
}
.tlprogfill{height:100%; width:0; background:var(--coral); transition:width .15s;}
.tlcam{
  position:absolute; right:2px; top:1px; font-size:9px;
  background:rgba(251,249,242,.85); border-radius:4px; padding:0 2px;
}
.tlprev{
  bottom:206px; left:50%; transform:translateX(-50%); z-index:21;
  flex-direction:column; align-items:stretch; padding:9px; gap:7px;
}
.tlprev canvas{
  display:block; margin:0 auto; border-radius:8px;
  border:1.5px solid var(--line-soft); max-width:min(88vw, 380px);
}
.tlprevrow{display:flex; align-items:center; gap:8px;}
#tlScrub{flex:1; accent-color:var(--coral); min-width:120px;}
.tlrec{
  width:34px; height:34px; border-radius:50%; font-size:15px; color:var(--ink-soft);
  border:1.5px solid var(--line-soft); background:var(--card); flex:0 0 auto;
}
.tlrec:hover{background:var(--card-2);}
.tlrec.on{color:#fff; background:#C0392B; border-color:#C0392B; animation:tlpulse 1.1s infinite;}
@keyframes tlpulse{ 0%,100%{box-shadow:0 0 0 0 rgba(192,57,43,.45);} 50%{box-shadow:0 0 0 7px rgba(192,57,43,0);} }
.tlbtn{flex:0 0 auto; padding:7px 11px; font-size:12px;}
.tlcount{font-size:11px; font-weight:700; color:var(--ink-soft); white-space:nowrap; flex:0 0 auto;}
.tlframes{
  display:flex; gap:6px; overflow-x:auto; flex:1; min-width:60px; padding:2px;
}
.tlframe{
  position:relative; flex:0 0 auto; border:2px solid var(--line-soft); border-radius:7px;
  cursor:pointer; overflow:hidden; background:var(--card-2);
}
.tlframe.sel{border-color:var(--coral);}
.tlframe canvas{display:block;}
.tlnum{
  position:absolute; left:3px; bottom:2px; font-size:9px; font-weight:800;
  background:rgba(251,249,242,.85); border-radius:4px; padding:0 4px; color:var(--ink);
}
.tlsize{flex:0 0 64px; padding:6px 4px;}
#tlFps{flex:0 0 78px;}
#tlBatch{flex:0 0 58px;}
#tlSize{flex:0 0 70px;}
#tlEase{flex:0 0 132px;}
.tlexport{flex:0 0 auto; font-size:12px; padding:8px 13px; margin:0;}
.gifdialog{width:400px;}
#gifPageList{display:flex; flex-direction:column; gap:6px; max-height:38vh; overflow-y:auto; margin-top:8px;}
.gifrow{
  display:flex; align-items:center; gap:8px; font-size:13px;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:8px;
}
.gifrow input[type=checkbox]{accent-color:var(--coral); width:15px; height:15px; flex:0 0 auto;}
.gifname{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.gifdelay{
  width:56px; height:28px; text-align:center; font-family:var(--sans); font-size:12.5px; font-weight:600;
  border:1.5px solid var(--line-soft); border-radius:7px; background:var(--card); color:var(--ink);
  font-variant-numeric:tabular-nums;
}
.gifdelay:focus{outline:none; border-color:var(--coral);}
.gifsec{font-size:11.5px; color:var(--ink-soft); font-weight:600;}
.gifdialog .row.actions{display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:10px;}
.gifdialog .row.actions .minipill{flex:0 0 auto; padding:8px 14px;}
.gifdialog .row.actions .pill{flex:0 0 auto; font-size:12.5px; padding:8px 16px; margin:0;}

/* brand kit settings */
.brandaccents{display:flex; gap:7px; flex-wrap:wrap;}
.brandacc{display:flex; flex-direction:column; align-items:center; gap:1px;}
.brandacc input{width:34px; height:30px; padding:0; border:none; background:none; cursor:pointer;}
.brandhex{
  font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:9px;
  letter-spacing:0; color:var(--ink-soft); text-transform:uppercase;
}
.brandrow{align-items:flex-start;}
.brandrow .chartcheck{white-space:nowrap; margin-top:6px;}
/* settings action rows: auto-width buttons, never the stretched panel style */
.setactions{display:flex; flex-wrap:wrap; gap:6px; margin-top:8px;}
.setactions .minipill{flex:0 0 auto; padding:8px 14px;}
.brandtextinput{
  flex:1; font-family:var(--sans); font-size:13px; font-weight:500;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); min-width:0;
}
.brandtextinput:focus{outline:none; border-color:var(--coral);}
.brandselect{
  flex:1; font-family:var(--sans); font-size:13px; font-weight:500;
  padding:6px 8px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); min-width:0; cursor:pointer;
}
.swatch.brandsw{outline:2px solid var(--coral-soft); outline-offset:-2px;}
.swatch.libsw{border-radius:50%;}
#imgRadiusRange{width:100%; accent-color:var(--coral); height:18px;}
.sizerow{display:flex; gap:5px; align-items:center;}
.sizerow .segment{flex:1; flex-wrap:nowrap;}
#sizeInput{
  width:46px; height:30px; flex:0 0 auto; text-align:center;
  font-family:var(--sans); font-size:12.5px; font-weight:600;
  font-variant-numeric:tabular-nums; -moz-appearance:textfield; appearance:textfield;
  border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink); padding:0 2px;
}
#sizeInput:focus{outline:none; border-color:var(--coral);}
#sizeInput::-webkit-inner-spin-button, #sizeInput::-webkit-outer-spin-button{-webkit-appearance:none; margin:0;}
.colorpop .libsavebtn{flex:0 0 auto; padding:7px 11px; font-size:12px; white-space:nowrap;}

/* font search + weight picker */
.fontsearchwrap{padding:4px 6px 6px;}
#fontSearch{
  width:100%; font-family:var(--sans); font-size:13px; font-weight:500;
  padding:7px 9px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card); color:var(--ink);
}
#fontSearch:focus{outline:none; border-color:var(--coral);}
.fontrow{display:flex; gap:5px;}
.fontrow .fontbtn{width:auto; flex:1; min-width:0;}
.fontrow .weightbtn{flex:0 0 52px; min-width:0; justify-content:center; padding-left:5px; padding-right:5px;}
.weightmenu{position:fixed; min-width:170px; max-height:60vh; overflow-y:auto; z-index:60;}
.weightmenu button.sel{color:var(--coral); font-weight:700;}
.chartslider input[type=range]{width:86px; height:16px; accent-color:var(--coral);}
.chartprevwrap{
  position:relative; margin-top:9px; border:1.5px solid var(--line-soft);
  border-radius:9px; overflow:hidden; background:var(--card-2);
}
#chartPreview{display:block; width:100%; height:200px;}
.charterr{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  padding:14px; text-align:center; font-size:12.5px; font-weight:600;
  color:#B3402A; background:var(--card);
}
body.dark .charterr{color:#F09070;}
.chartdialog .row.actions{display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:10px;}
.chartdialog .row.actions .minipill{flex:0 0 auto; padding:8px 14px;}
.chartdialog .row.actions .pill{flex:0 0 auto; font-size:12.5px; padding:8px 16px; margin:0;}

.menukey{float:right; font-size:11px; color:var(--ink-soft); letter-spacing:.4px;}
#expTransToggle{font-weight:650;}
.menucheck{
  float:right; width:18px; height:18px; border-radius:5px;
  border:2px solid var(--line); background:var(--paper); text-align:center;
  font-size:12px; font-weight:800; line-height:15px; color:#FBF6EE;
}
#expTransToggle.sel .menucheck{background:var(--coral); border-color:var(--coral);}

/* ── arrange row: one logic per line ── */
.segstack{display:flex; flex-direction:column; gap:4px;}

/* ── foldable panel sections ── */
.stylePanel .row.foldable > label{cursor:pointer; user-select:none; display:flex; align-items:center;}
.stylePanel .row.foldable > label::after{
  content:'▾'; margin-left:auto; font-size:9px; opacity:.45;
  transition:transform .15s;
}
.stylePanel .row.foldedrow > label::after{transform:rotate(-90deg);}
.stylePanel .row.foldedrow > :not(label){display:none;}
.stylePanel .row.foldedrow{gap:0;}
.labelval{margin-left:auto; margin-right:14px; font-size:11px; font-weight:700; color:var(--ink); text-transform:none; letter-spacing:0;}
.stylePanel .zonegap{margin-top:5px; padding-top:11px; border-top:1.5px solid var(--line-soft);}

/* ── sticky quick actions: always reachable, no scrolling ── */
.stylePanel .row.actions{
  position:sticky; bottom:-11px; z-index:3;
  flex-direction:row; flex-wrap:wrap; gap:5px;
  background:var(--card);
  margin:2px -13px -11px; padding:9px 13px 11px;
  border-top:1.5px solid var(--line-soft);
}

/* ── page-thumb drag reorder ── */
.pagethumb{cursor:grab; touch-action:none;}
.pagethumb.dragsrc{opacity:.45; transform:scale(.94); cursor:grabbing;}
.pagethumb.dropbefore{box-shadow:-3px 0 0 0 var(--coral);}
.pagethumb.dropafter{box-shadow:3px 0 0 0 var(--coral);}

/* ── work-protection banners ── */
.warnbanner{
  position:fixed; left:50%; transform:translateX(-50%); bottom:78px;
  z-index:80; max-width:min(560px, calc(100vw - 40px));
  background:#8A4B1F; color:#FDF3E4;
  border:1.5px solid rgba(0,0,0,.25); border-radius:12px;
  box-shadow:0 8px 24px -8px rgba(0,0,0,.45);
  font-size:13px; line-height:1.5; padding:11px 14px;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  pointer-events:auto;
}
.warnbanner b{font-weight:700;}
.warnbanner .minipill{
  background:#FDF3E4; color:#6B3812; border:none; font-weight:700;
  flex:0 0 auto; margin-left:auto;
}
.warnbanner.tabwarn{bottom:auto; top:76px; background:#4A5568; color:#F2F5FA;}
.warnbanner.tabwarn .minipill{background:#F2F5FA; color:#33404F;}

/* ── Claude link ── */
.claudelink{color:var(--coral);}
.claudelink svg{animation:claudepulse 2.6s ease-in-out infinite;}
@keyframes claudepulse{0%,100%{opacity:1;transform:none}50%{opacity:.55;transform:rotate(20deg)}}
.claudestatus{
  font-size:12.5px; line-height:1.5; padding:7px 10px; border-radius:9px;
  background:color-mix(in srgb, var(--ink) 6%, transparent); color:var(--ink-soft);
  margin:2px 0 10px;
}
.claudestatus.on{
  background:color-mix(in srgb, var(--coral) 14%, transparent);
  color:var(--ink); font-weight:500;
}
#claudePane p{font-size:12.5px; line-height:1.55; color:var(--ink-soft); margin:0 0 10px;}
#claudePane a{color:var(--coral);}
#claudePane code{font-size:11.5px; background:color-mix(in srgb, var(--ink) 7%, transparent);
  padding:1px 5px; border-radius:5px;}

/* ── presentation mode ── */
body.presenting .island,
body.presenting .hint,
body.presenting #tooltip{display:none !important;}
body.presenting #board{cursor:crosshair;}
.presentbar{
  position:fixed; left:50%; bottom:26px; transform:translateX(-50%);
  z-index:70; display:flex; align-items:center; gap:4px;
  background:var(--ink); color:var(--paper);
  padding:6px 10px; border-radius:99px;
  box-shadow:0 6px 20px -6px rgba(0,0,0,.4);
  opacity:0; transition:opacity .25s; pointer-events:none;
}
.presentbar.awake{opacity:1; pointer-events:auto;}
.presentbar button{
  background:none; border:none; color:var(--paper); cursor:pointer;
  font-size:17px; line-height:1; padding:4px 9px; border-radius:99px;
}
.presentbar button:hover{background:color-mix(in srgb, var(--paper) 18%, transparent);}
.presentbar #presPage{font-size:12.5px; letter-spacing:.4px; padding:0 4px; user-select:none;}
.presentbar .presdiv{width:1px; height:16px; background:color-mix(in srgb, var(--paper) 25%, transparent); margin:0 4px;}
#laser{position:fixed; inset:0; z-index:60; pointer-events:none;}

#tooltip{
  position:fixed; z-index:99; pointer-events:none;
  background:var(--ink); color:var(--paper);
  font-size:12px; line-height:1.45; letter-spacing:.1px;
  padding:5px 10px 6px; border-radius:8px; max-width:270px;
  box-shadow:0 4px 14px -4px rgba(0,0,0,.35);
  opacity:0; transform:translateY(2px);
  transition:opacity .13s ease, transform .13s ease;
}
#tooltip.show{opacity:1; transform:none;}
#tooltip .tipkey{
  display:inline-block; margin-left:8px; padding:0 6px;
  border-radius:5px; font-size:11px; font-weight:600; letter-spacing:.6px;
  background:color-mix(in srgb, var(--paper) 22%, transparent);
}
body.dark #tooltip{box-shadow:0 4px 14px -4px rgba(0,0,0,.7);}

.menuver{
  font-size:11px; color:var(--ink-soft); text-align:center;
  padding:7px 0 3px; border-top:1.5px solid var(--line-soft); margin-top:4px;
  user-select:none;
}

.hint{
  position:absolute; bottom:84px; left:50%; transform:translateX(-50%);
  font-size:12.5px; color:var(--ink-soft); pointer-events:none;
  background:color-mix(in srgb, var(--paper) 72%, transparent);
  padding:4px 12px; border-radius:99px;
  white-space:nowrap; opacity:0; transition:opacity .25s;
}
.hint.show{opacity:1;}

.welcomewrap{
  position:fixed; inset:0; z-index:60;
  display:flex; align-items:center; justify-content:center;
  background:color-mix(in srgb, var(--ink) 26%, transparent);
  backdrop-filter:blur(2px);
}
.welcome{
  display:block;
  width:min(440px, calc(100vw - 48px));
  padding:34px 36px 28px; text-align:center;
  animation:welcomein .35s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes welcomein{ from{opacity:0; transform:translateY(14px) scale(.97);} to{opacity:1; transform:none;} }
.welcome h2{
  font-family:var(--serif); font-weight:500; font-size:26px;
  margin:14px 0 2px; letter-spacing:.2px;
}
.welcome h2 b{font-weight:700;}
.welcome .wmotto{
  font-family:var(--serif); font-style:italic; font-size:16px;
  color:var(--coral); margin:0 0 14px;
}
.welcome .wbody{
  font-size:13.5px; line-height:1.55; color:var(--ink-soft); margin:0 0 20px;
}
.welcome .actions{justify-content:center; gap:10px; flex-wrap:wrap;}

.shortcuts{
  bottom:14px; right:14px; width:390px;
  flex-direction:column; align-items:stretch; padding:16px 18px 13px; gap:8px;
}
.shortcuts h3{font-family:var(--serif); font-style:italic; font-size:17px; font-weight:600;}
.shortcuts{max-height:78vh; overflow-y:auto;}
.paneltabs{display:flex; gap:6px; margin-bottom:10px;}
.paneltabs button{
  flex:1; height:30px; border-radius:8px; border:1.5px solid var(--line-soft);
  font-size:12.5px; font-weight:600; background:transparent; color:var(--ink);
}
.paneltabs button.sel{background:var(--coral); border-color:var(--coral); color:#FBF6EE;}
.setdesc{font-size:12px; color:var(--ink-soft); line-height:1.5; margin:6px 0 12px;}
.setrow{display:flex; align-items:center; gap:10px; margin:9px 0;}
.setrow label{width:58px; font-size:12.5px; font-weight:600;}
.setrow input[type=range]{flex:1;}
.setrow b{width:30px; text-align:right; font-size:12.5px; font-variant-numeric:tabular-nums;}
.setactions{margin-top:8px;}
.docsize{
  font-size:11.5px; color:var(--ink-soft); margin:6px 0 0;
  padding:6px 9px; border-radius:8px;
  background:color-mix(in srgb, var(--ink) 5%, transparent);
}
.setreset{padding:5px 11px; font-size:11px;}
.shortcuts td.sect{
  font-family:var(--serif); font-style:italic; font-weight:600; font-size:13px;
  color:var(--ink); padding-top:9px;
}
.shortcuts .credit{
  margin:10px 0 0; padding-top:9px; border-top:1px dashed var(--line-soft);
  font-size:11.5px; color:var(--ink-soft);
}
.shortcuts .credit a{color:var(--coral); font-weight:600; text-decoration:none;}
.shortcuts .credit a:hover{text-decoration:underline;}
.shortcuts table{border-collapse:collapse;}
.shortcuts td{font-size:12.5px; line-height:1.5; padding:3.5px 0; color:var(--ink-soft);
  border-bottom:1px solid var(--line-soft);}
.shortcuts tr:last-child td{border-bottom:none;}
.shortcuts td b{color:var(--ink); font-weight:700;}

/* ── custom color popover ───────────────────────── */
.colorpop{z-index:40; padding:8px 10px; gap:8px;}
#popColor{
  width:38px; height:32px; padding:0; border:none; background:none; cursor:pointer;
}
#popHex{
  width:92px; font-family:ui-monospace,"SF Mono",Menlo,monospace; font-size:13px;
  padding:6px 8px; border:1.5px solid var(--line-soft); border-radius:8px;
  background:var(--card-2); color:var(--ink); outline:none; text-transform:uppercase;
}
#popHex:focus{border-color:var(--coral);}

/* ── text editor overlay ─────────────────────────── */
#textEditor{
  position:fixed; z-index:20;
  background:transparent; border:none; outline:none; resize:none; overflow:hidden;
  color:var(--ink); caret-color:var(--coral);
  white-space:pre; padding:0;
}

.hidden{display:none !important;}

::-webkit-scrollbar{width:9px;}
::-webkit-scrollbar-thumb{background:var(--line-soft); border-radius:8px;}

/* while editing, the textarea is a transparent input layer over the live
   canvas text — keep its selection band visible but let the glyphs show */
#textEditor::selection{background:rgba(91,107,184,.30); color:transparent;}

/* ── tablet / iPad layout ───────────────────────── */
@media (max-width:1024px){
  .stylePanel{top:130px; width:196px; max-height:calc(100vh - 220px); padding:11px 11px 9px;}
  .shortcuts{width:min(92vw, 390px); max-height:calc(100vh - 100px);}
  .zoombar{bottom:12px; left:10px; padding:4px;}
  .zoombar .boardlabel{padding:0 8px;}
  .pagestrip{max-width:44vw;}
}
@media (max-width:820px){
  .brand .motto{display:none;}
  .brand .name{font-size:16px;}
  .toolbar{max-width:96vw; flex-wrap:wrap; justify-content:center;}
  .quick{max-width:60vw; flex-wrap:wrap; justify-content:flex-end;}
  #zoomLabel{display:none;}
  .pagestrip{max-width:38vw;}
  .presentbar{bottom:14px;}
}
/* fingers need meat: grow every hit target on touch devices */
@media (pointer:coarse){
  .toolbtn,.iconbtn{width:42px; height:42px;}
  .swatch{width:28px; height:28px;}
  .segment button{min-height:34px;}
  .menu button{padding:11px 12px;}
  .stylePanel{width:218px;}
  .pagestrip .pagethumb{min-width:56px; min-height:42px;}
  input[type=range]{height:30px;}
}
