:root{--bg:#fff;--fg:#000;--mute:#8a8a8a;--line:#ebebeb;--dash:#d0d0d0;--soft:#f5f5f5;--err:#d92d20;--ease:cubic-bezier(.22,.8,.26,1);color-scheme:light}
:root[data-theme=dark]{--bg:#000;--fg:#f0f0f0;--mute:#7a7a7a;--line:#1f1f1f;--dash:#333;--soft:#141414;--err:#ff6b5e;color-scheme:dark}
*{margin:0;padding:0;box-sizing:border-box}
body{font:16px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif;color:var(--fg);background:var(--bg);min-height:100vh;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%}
[hidden]{display:none!important}
button,input,textarea{font:inherit;color:inherit}
button{background:none;border:0;cursor:pointer;-webkit-tap-highlight-color:transparent}
::placeholder{color:var(--mute);opacity:1}
:focus-visible{outline:2px solid var(--fg);outline-offset:3px;border-radius:6px}
.tt,.tt *{transition:background-color .35s,color .35s,border-color .35s!important}

.wrap{max-width:640px;margin:0 auto;padding:0 1.25rem calc(3rem + env(safe-area-inset-bottom))}
header{display:flex;justify-content:space-between;align-items:center;padding:1rem 0 0}
.logo{font-weight:700;font-size:.95rem;letter-spacing:.12em}
.ico{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;display:block;flex:none}
.round{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;flex:none;color:inherit;text-decoration:none;transition:background .2s,transform .2s,opacity .2s}
.round:hover{background:var(--soft)}
.round:active{transform:scale(.9)}
.round.ghost{border:1px solid var(--line)}
.round.sm{width:32px;height:32px}
.copy .c2,.copy.done .c1{display:none}
.copy.done .c2{display:block}
:root[data-theme=dark] .t-moon,:root:not([data-theme=dark]) .t-sun{display:none}

.bar{position:relative;display:flex;gap:1.75rem;margin-top:clamp(1.5rem,6vh,3rem);border-bottom:1px solid var(--line)}
.tab{padding:.5rem 0 .85rem;font-size:clamp(1.5rem,6vw,1.75rem);font-weight:650;letter-spacing:-.02em;color:var(--mute);transition:color .25s}
.tab:hover,.tab[aria-selected=true]{color:var(--fg)}
.ink{position:absolute;left:0;bottom:-1px;height:2px;width:0;background:var(--fg);transition:transform .4s var(--ease),width .4s var(--ease)}

.stack{padding-top:1.5rem}
.enter{animation:in .45s var(--ease) both}
@keyframes in{from{opacity:0;transform:translateY(10px)}}
@keyframes rot{to{transform:rotate(360deg)}}

.fold{display:grid;grid-template-rows:1fr;transition:grid-template-rows .45s var(--ease),opacity .3s}
.fold.off{grid-template-rows:0fr;opacity:0;visibility:hidden;transition:grid-template-rows .45s var(--ease),opacity .3s,visibility 0s .45s}
.fold>.in{min-height:0;overflow:hidden}
.pad{padding-top:1rem}
#res .pad{padding-top:1.5rem}

.box{position:relative;height:clamp(11rem,34vh,15rem);border:1px solid transparent;border-radius:16px;background:var(--soft);transition:border-color .25s}
.box:focus-within,.box.drag,.chip.drag{border-color:var(--fg)}
.box textarea{position:absolute;inset:0;width:100%;height:100%;padding:1rem 3.25rem 1rem 1.1rem;border:0;border-radius:16px;outline:0;background:none;resize:none;font-size:1rem;line-height:1.7}
.pv{position:absolute;inset:0;overflow:hidden;border-radius:16px;animation:in .35s var(--ease)}
.pv img{width:100%;height:100%;padding:.75rem;object-fit:contain}
.pv .round{position:absolute;top:.5rem;right:.5rem;background:var(--bg);border:1px solid var(--line)}
.pick{position:absolute;right:.5rem;bottom:.5rem}

.chip{display:inline-flex;align-items:center;max-width:100%;height:40px;border:1px dashed var(--dash);border-radius:20px;transition:border-color .25s}
.chip:hover{border-color:var(--fg)}
.chip.set{border-style:solid;border-color:var(--line)}
.cbtn{display:flex;align-items:center;gap:.5rem;min-width:0;height:100%;padding:0 1rem 0 .85rem;font-size:.9rem;color:var(--mute);transition:color .2s}
.chip:hover .cbtn,.chip.set .cbtn{color:var(--fg)}
.chip.set .cbtn{padding:0 .5rem 0 .4rem}
.cbtn img{width:26px;height:26px;border-radius:8px;object-fit:cover}
.cbtn span{max-width:12rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip .round{margin-right:.25rem}

.actions{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-top:1.5rem}
.btn{position:relative;min-width:8.5rem;height:48px;padding:0 2rem;border-radius:24px;background:var(--fg);color:var(--bg);font-weight:600;transition:opacity .25s,transform .2s}
.btn:hover:not(:disabled){opacity:.85}
.btn:active:not(:disabled){transform:scale(.97)}
.btn:disabled{opacity:.3;cursor:default}
.lbl{transition:opacity .15s}
.spin{position:absolute;left:50%;top:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid currentColor;border-top-color:transparent;border-radius:50%;opacity:0;animation:rot .7s linear infinite;transition:opacity .2s}
.btn.busy{pointer-events:none}
.busy .lbl{opacity:0}
.busy .spin{opacity:1}
.adv{display:flex;align-items:center;gap:.25rem;padding:.5rem 0;font-size:.85rem;color:var(--mute);transition:color .2s}
.adv:hover{color:var(--fg)}
.adv .ico{width:16px;height:16px;transition:transform .35s var(--ease)}
.adv[aria-expanded=true] .ico{transform:rotate(180deg)}

.key{display:flex;align-items:center;gap:1rem;padding:0 1.1rem;border:1px solid transparent;border-radius:14px;background:var(--soft);transition:border-color .25s}
.key:focus-within{border-color:var(--fg)}
.key span{font-size:.85rem;color:var(--mute)}
.key input{flex:1;min-width:0;height:44px;border:0;outline:0;background:none}

.view{border-radius:16px;background:var(--soft)}
#vImg{padding:.75rem}
#vImg img{display:block;max-width:100%;max-height:22rem;margin:0 auto;border-radius:10px}
pre.view{max-height:14rem;overflow:auto;padding:1rem 1.1rem;font:inherit;font-size:.95rem;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}
.file{display:flex;justify-content:space-between;gap:1rem;padding:1rem 1.1rem}
.file span:last-child{flex:none;font-size:.85rem;color:var(--mute)}
.file span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.err{font-size:.9rem;color:var(--err)}
.tools{display:flex;justify-content:flex-end;gap:.5rem;margin-top:.75rem}
.warn{margin-top:3rem;text-align:center;font-size:.8rem;color:var(--err)}

.toast{position:fixed;left:50%;bottom:calc(1.5rem + env(safe-area-inset-bottom));max-width:calc(100vw - 2rem);padding:.6rem 1.1rem;border-radius:999px;background:var(--fg);color:var(--bg);font-size:.85rem;opacity:0;transform:translate(-50%,14px);pointer-events:none;z-index:9;transition:opacity .3s,transform .4s var(--ease)}
.toast.show{opacity:1;transform:translate(-50%,0)}

@media(prefers-reduced-motion:reduce){*,::before,::after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
