:root{--page:#f8f8f5;--ink:#232622;--muted:#6c716d;--line:#dedfd8;--blue:#354bc0;--accent-bg:#f1f3ff;--sans:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;color-scheme:light;font:100%/1.5 var(--sans);color:var(--ink);background:var(--page)}
*{box-sizing:border-box}body{margin:0}button,select,textarea{font:inherit;color:inherit}button,a,select{touch-action:manipulation}button,a.button{text-decoration:none;cursor:pointer}button{background:none;border:0}a{color:inherit}button:disabled{opacity:.44;cursor:default}button:focus-visible,a:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #8998ef;outline-offset:3px}[hidden]{display:none!important}i[data-icon]{display:inline-flex;align-items:center;justify-content:center;flex:none}i svg{width:1.12rem;height:1.12rem;stroke:currentColor;fill:none;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.frame{width:min(1240px,calc(100% - clamp(40px,8vw,128px)));margin:auto}.mast{border-bottom:1px solid var(--line);background:#fcfcf9}.mast-inner{height:66px;display:flex;align-items:center;justify-content:space-between}.wordmark,.source,.actions,.button,.text-button,.field-head,.panel-head,.caption,.dialog-head,.dialog-actions{display:flex;align-items:center}.wordmark{gap:.68rem}.wordmark b{font:750 1.44rem/1 var(--sans);letter-spacing:-.06em}.wordmark span{color:#545950;font-size:.91rem;letter-spacing:-.045em;border-left:1px solid #cecec6;padding-left:.7rem;font-weight:560}.source{gap:.48rem;font:550 .85rem/1.4 var(--sans);text-decoration:none;padding:.7rem .1rem}.source:hover,.text-button:hover{color:#172993}.source i svg{width:1.12rem;height:1.12rem}
.intro{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;padding:2.35rem 0 1.65rem}.intro h1{margin:0;font-size:clamp(2.15rem,3.4vw,3.15rem);line-height:1.18;font-weight:740;letter-spacing:-.065em}.intro h1 span{color:var(--blue);font-family:Georgia,serif;margin-left:.075em}.intro p{margin:.52rem 0 0;color:var(--muted);font-size:1rem}.actions,.dialog-actions{gap:.6rem}.button{border:1px solid #cccfc7;border-radius:7px;background:#fff;gap:.5rem;justify-content:center;min-height:43px;padding:.55rem .98rem;font-weight:620;font-size:.9rem;white-space:nowrap;transition:background .15s,transform .15s}.button:hover:enabled,.button[href]:hover{background:#f4f5ef}.button:active:enabled{transform:translateY(1px)}.button.primary{background:var(--blue);color:white;border-color:var(--blue)}.button.primary:hover:enabled,.button.primary[href]:hover{background:#293da4}.actions{padding-bottom:.13rem}
.workspace{display:grid;grid-template-columns:minmax(0,1.53fr) minmax(330px,1fr);gap:20px;align-items:stretch;margin-bottom:2rem}.card{background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden}.panel-head{height:50px;justify-content:space-between;padding:0 1.2rem;border-bottom:1px solid var(--line)}h2{font-size:1rem;font-weight:670;margin:0}.panel-head h2{display:flex;gap:.55rem;align-items:center}.panel-head h2 svg{width:1.04rem;height:1.04rem}.icon-button{display:grid;place-items:center;width:40px;height:40px;border-radius:6px;color:#555c55}.icon-button:hover{background:#f0f1ec}.preview{display:flex;flex-direction:column}.stage{position:relative;isolation:isolate;flex:1;min-height:470px;display:grid;place-items:center;background-color:#eeefe9;background-image:radial-gradient(#c3c7bc .75px,transparent .9px);background-size:9px 9px;padding:26px 23px}.paper{position:relative;width:min(100%,calc(var(--paper-h,480px) * var(--ratio,.75)));line-height:0;box-shadow:0 13px 20px -10px #22302755,0 2px 5px #23332824}.paper canvas{width:100%;height:auto;display:block}.crop{position:absolute;width:9px;height:9px;border:0 solid #999f8f;pointer-events:none}.tl{left:-9px;top:-9px;border-width:1px 0 0 1px}.tr{right:-9px;top:-9px;border-width:1px 1px 0 0}.bl{left:-9px;bottom:-9px;border-width:0 0 1px 1px}.br{right:-9px;bottom:-9px;border-width:0 1px 1px 0}.caption{justify-content:space-between;gap:.5rem;min-height:40px;padding:.35rem 1.15rem;border-top:1px solid var(--line);font-size:.78rem;color:#62675f}.caption>span:first-child{display:flex;gap:.5rem;align-items:center}#ink-chip{width:.6rem;height:.6rem;border-radius:2px;background:var(--blue)}.dimensions,.secondary,#counter{font-variant-numeric:tabular-nums}.dimensions{font-family:ui-monospace,monospace;letter-spacing:-.03em}.empty{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:.6rem;color:var(--muted)}.empty a,.text-button{color:var(--blue)}
.settings-body{display:grid;gap:1.05rem;padding:1.1rem 1.25rem 1.3rem}.field,fieldset{min-width:0}fieldset{padding:0;margin:0;border:0}label,legend,.label{font-size:.92rem;font-weight:650}legend{padding:0;margin:0 0 .46rem}.field>label{display:block;margin-bottom:.43rem}.field-head,.dialog-head{justify-content:space-between}.field-head{margin-bottom:.45rem;min-height:24px}.text-button{font-weight:570;font-size:.8rem;display:flex;gap:.35rem;align-items:center;padding:.2rem 0}.text-button svg{width:.89rem;height:.89rem}.text-box{border:1px solid #d4d6cd;border-radius:7px;background:#fdfdfa;overflow:hidden}.text-box:focus-within,.select-wrap:focus-within{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue)}textarea{display:block;width:100%;resize:vertical;min-height:76px;height:80px;padding:.55rem .75rem 0;line-height:1.36;background:transparent;border:0;border-radius:6px;font-size:1rem}textarea:focus-visible{outline:none}#counter{color:#75796f;text-align:right;font-size:.75rem;padding:0 .65rem .35rem;pointer-events:none}.layouts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.54rem}.layout{padding:0;text-align:left;font-size:.81rem;font-weight:560;position:relative;min-width:0}.tile{display:block;border-radius:5px;overflow:hidden;border:2px solid transparent;outline:1px solid #dcded7;outline-offset:-1px;padding:2px;margin:0 0 .24rem;background:#fff}.tile canvas{display:block;width:100%;border-radius:2px}.layout[aria-pressed=true]{color:var(--blue)}.layout[aria-pressed=true] .tile{border-color:var(--blue);outline:none}.layout-name{display:flex;align-items:center;gap:.28rem;justify-content:center}.layout-name svg{width:.75rem;height:.75rem;stroke-width:2.8}.layout:not([aria-pressed=true]) .layout-name i{display:none}
.select-wrap{position:relative;border:1px solid #d4d6cd;border-radius:7px}.select-wrap select{display:block;appearance:none;padding:.5rem 2.2rem .5rem 3rem;width:100%;height:42px;border:0;border-radius:6px;background:transparent;font-size:1rem;cursor:pointer}.select-wrap select:focus{outline:0}.font-icon{font-family:Georgia,serif;position:absolute;left:.8rem;top:50%;transform:translateY(-50%);font-size:1.2rem;color:#61665d;pointer-events:none}.select-wrap>i{position:absolute;right:.72rem;top:50%;transform:translateY(-50%);pointer-events:none}.secondary{font-size:.78rem;color:var(--muted)}.swatches{display:flex;gap:10px;align-items:center}.swatch{position:relative;width:35px;height:35px;border-radius:50%;background:var(--swatch);border:3px solid white;box-shadow:0 0 0 1px #d8dad3;color:var(--swatch-ink);display:grid;place-items:center;padding:0}.swatch:hover{box-shadow:0 0 0 1px #53574e}.swatch[aria-pressed=true]{box-shadow:0 0 0 1.7px var(--swatch-ring)}.swatch:not([aria-pressed=true]) i{display:none}.swatch svg{width:15px;height:15px;stroke-width:2.3}.ratios{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.45rem}.ratio{border:1px solid #d5d7cf;border-radius:6px;display:flex;align-items:center;justify-content:center;gap:.38rem;min-height:37px;font-size:.85rem}.ratio[aria-pressed=true]{border-color:#6c7cd3;color:#2a41b0;background:#f2f4ff}.ratio-mark{display:inline-block;width:10px;height:13px;border:1.3px solid currentColor;border-radius:1px}.image-well{display:grid;place-items:center;background:#eff0eb;border-radius:6px;padding:12px}.image-well img{display:block;width:auto;height:auto;max-width:100%;max-height:55dvh;box-shadow:0 4px 12px #2428242b}dialog{border:1px solid var(--line);border-radius:13px;padding:1rem;width:min(430px,calc(100% - 28px));max-height:92dvh;color:var(--ink);box-shadow:0 15px 60px #2223}dialog::backdrop{background:#151c27a3}.dialog-head{margin:0 0 .65rem}.dialog-head h2{font-size:1.15rem}#file-info{text-align:center;color:var(--muted);font-size:.86rem}.dialog-actions>*{flex:1}#export-tools small{display:block;text-align:center;color:var(--muted);margin-top:.65rem}#message{position:fixed;z-index:15;bottom:22px;left:50%;transform:translateX(-50%);max-width:calc(100% - 20px);width:max-content;border-radius:7px;background:#282d26;color:white;font-size:.88rem;padding:.58rem .9rem;pointer-events:none;opacity:0}#message.show{opacity:1}
@media(min-width:1450px){.stage{--paper-h:510px}.settings-body{gap:1.22rem}}
@media(max-width:820px){.frame{width:calc(100% - 36px)}.workspace{gap:12px;grid-template-columns:minmax(0,1.1fr) minmax(290px,1fr)}.settings-body{padding:1rem}.stage{min-height:400px}.intro{padding:1.7rem 0 1.3rem}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
dialog.expanded{width:min(720px,calc(100% - 22px))}dialog.expanded .image-well img{max-height:78dvh}dialog[open] #message{position:sticky;display:none;margin:.6rem auto 0;transform:none;left:auto;bottom:auto}dialog[open] #message.show{display:block}

.editor-switch,
#open-paper {
  display: none;
}
#style-panel {
  display: grid;
  gap: inherit;
}

@media (max-width: 680px), (max-width: 960px) and (max-height: 520px) and (pointer: coarse) {
  :root { --page: #f8f8f5; }
  .frame { width: min(100% - 36px, 540px); }
  .mast {
    background: var(--page);
    border: 0;
  }
  .mast-inner { height: 60px; }
  .wordmark { gap: .45rem; }
  .wordmark img { width: 25px; height: 25px; }
  .wordmark b { font-size: 1.12rem; }
  .wordmark span, .source, .intro, .panel-head, .caption,
  .crop, #writing-panel .field-head, #counter { display: none; }
  .mast-inner > .primary {
    min-height: 44px;
    border-radius: 8px;
    padding: .5rem .88rem;
    font-size: .88rem;
  }
  .workspace {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 auto;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
  .card {
    border: 0;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .stage {
    --paper-h: clamp(170px, min(58svh, calc(100svh - 265px)), 565px);
    min-height: 0;
    padding: 10px 7px 22px;
    background: none;
  }
  .stage:has(.empty:not([hidden])) {
    min-height: min(var(--paper-h), 68vw);
  }
  .paper {
    box-shadow: 0 3px 12px #252a341c, 0 1px 2px #252a3417;
  }
  #open-paper {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0;
  }
  .settings-body { padding: 0; gap: 0; }
  .editor-switch {
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 50px;
  }
  .editor-switch [role="tablist"] { display: flex; gap: .82rem; }
  .editor-switch [role="tab"] {
    position: relative;
    min-width: 44px;
    min-height: 46px;
    padding: 0;
    font-size: .96rem;
    color: var(--muted);
  }
  .editor-switch [role="tab"][aria-selected="true"] {
    font-weight: 680;
    color: var(--ink);
  }
  .editor-switch [role="tab"][aria-selected="true"]::after {
    content: "";
    position: absolute;
    bottom: 2px;
    left: calc(50% - 10px);
    width: 20px;
    height: 2px;
    background: var(--ink);
  }
  .editor-switch #copy {
    border: 0;
    padding: 0 .2rem;
    min-height: 44px;
    background: transparent;
    font-size: .84rem;
    font-weight: 500;
    color: #555d55;
    gap: .3rem;
  }
  .editor-switch #copy svg { width: .95rem; height: .95rem; }
  #writing-panel { margin-top: .45rem; }
  .text-box {
    background: #fff;
    border-color: #d9dcd4;
    border-radius: 8px;
  }
  #writing {
    min-height: 98px;
    height: 98px;
    padding: .56rem .8rem;
    line-height: 1.55;
    resize: none;
    scroll-margin: 12px;
  }
  #style-panel { gap: 1rem; padding: .8rem 0 .3rem; }
  #style-panel .source {
    display: inline-flex;
    justify-self: start;
    min-height: 44px;
    color: var(--muted);
  }
  .tile canvas { max-height: 78px; }
  .select-wrap select, .ratio { min-height: 44px; }
  .swatches { gap: 6px; }
  .swatch {
    width: 44px;
    height: 44px;
    border-width: 6px;
    border-color: var(--page);
  }
  #message { bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (max-width: 960px) and (max-height: 520px) and (pointer: coarse) and (orientation: landscape) {
  .frame { width: calc(100% - 40px); }
  .mast-inner { height: 50px; }
  .workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 24px;
  }
  .stage { --paper-h: calc(100svh - 76px); padding: 2px 0; }
}
