:root{color-scheme:dark;--bg:#101821;--panel:#18232d;--panel2:#1d2a35;--ink:#f5f0e6;--muted:#91a0a8;--line:#34414a;--accent:#f5aa80;--accent2:#ffd5a7;--warn:#ffcf70;font-family:Arial,Helvetica,sans-serif;-webkit-text-size-adjust:100%}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink)}
body{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;padding-bottom:env(safe-area-inset-bottom)}
button,input{font:inherit;color:inherit}
button{cursor:pointer;-webkit-tap-highlight-color:transparent}
button:focus-visible,input:focus-visible,a:focus-visible,.pick:focus-within{outline:2px solid var(--accent2);outline-offset:3px}
a{color:var(--accent2)}

.topbar{height:60px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 max(16px,env(safe-area-inset-left));background:#111a23}
.brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:var(--ink)}
.brand-mark{width:34px;height:34px;display:flex;align-items:center;justify-content:center;border:1px solid var(--accent);border-radius:50%;font:bold 13px Georgia,serif;letter-spacing:-1px;color:var(--accent2)}
.brand-mark span{color:var(--accent)}
.brand-copy{font-size:13px;font-weight:800;letter-spacing:.16em}
.brand-copy small{display:block;font-size:9px;letter-spacing:.19em;font-weight:600;color:var(--muted);margin-top:3px}
.topbar-side,.eyebrow{font-size:10px;font-weight:800;letter-spacing:.18em}
.topbar-side{color:var(--muted)}
.topbar-side.off{color:var(--accent2)}

main{width:100%;max-width:560px;margin:0 auto;padding:0 16px;flex:1}
.intro{padding:22px 0 14px}
.intro h1{font:normal 36px/1.02 Georgia,serif;letter-spacing:-.045em;margin:0 0 10px}
.intro h1 em{color:var(--accent);font-style:italic}
.intro p{margin:0;color:#aeb9bd;font-size:15px;line-height:1.5}
.eyebrow{color:var(--accent);margin:0 0 10px;padding:0}

.pick{position:relative;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:16px;align-items:center;min-height:84px;padding:16px 18px;margin:8px 0 18px;background:var(--accent);color:#1a2229;border-radius:10px;cursor:pointer;-webkit-tap-highlight-color:transparent}
.pick input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.pick-icon{grid-row:span 2;width:46px;height:46px;border-radius:50%;background:#1a2229;color:var(--accent);display:grid;place-items:center;font-size:28px;line-height:1}
.pick-main{font-size:19px;font-weight:800}
.pick-sub{font-size:13px;opacity:.75}
.pick.has-photo{background:var(--panel2);color:var(--ink);border:1px solid var(--line);min-height:64px}
.pick.has-photo .pick-icon{background:var(--accent);color:#1a2229;width:38px;height:38px;font-size:22px}
.pick.has-photo .pick-main{font-size:16px}
.pick.drag{outline:2px dashed var(--accent2);outline-offset:4px}

.sizes{border:0;margin:0 0 18px;padding:0;min-width:0}
.seg{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.seg button{min-height:58px;border:1px solid var(--line);border-radius:8px;background:var(--panel);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:6px 2px}
.seg button strong{font-size:15px}
.seg button small{font-size:11px;color:var(--muted)}
.seg button[aria-pressed="true"]{border-color:var(--accent);background:#2a2722;color:var(--accent2)}
.seg button[aria-pressed="true"] small{color:var(--accent2)}
.toggle{display:flex;align-items:center;gap:12px;min-height:48px;margin-top:8px;font-size:15px;cursor:pointer}
.toggle input{width:24px;height:24px;accent-color:var(--accent);margin:0;flex:none}
.toggle small{display:block;color:var(--muted);font-size:12px;margin-top:2px}
.toggle.disabled{opacity:.55;cursor:default}

.result{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:14px;margin-bottom:14px}
.preview-wrap{background:#0b1117;border-radius:6px;display:flex;align-items:center;justify-content:center;min-height:120px;overflow:hidden}
.preview-wrap img{display:block;max-width:100%;max-height:52vh;height:auto}
.stats{margin:12px 0 0;font-size:14px;line-height:1.5;color:#cfd6d8;font-variant-numeric:tabular-nums}
.stats b{color:var(--accent2);font-weight:700}
.warn{margin:10px 0 0;padding:10px 12px;border-left:3px solid var(--warn);background:#2b2a1f;color:var(--warn);font-size:14px;line-height:1.45;border-radius:0 6px 6px 0}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:14px}
.actions button{min-height:54px;border-radius:8px;border:1px solid var(--line);background:var(--panel2);font-size:16px;font-weight:700}
.actions .primary{grid-column:1/-1;background:var(--accent);border-color:var(--accent);color:#1a2229;font-size:18px;min-height:60px}
.actions #copy-help:only-of-type,.actions #share[hidden]+#copy-help{grid-column:1/-1}
.actions button.done{background:#2f4a3a;border-color:#6fcf97;color:#d9ffe7}
.raw{margin-top:12px;font-size:13px;color:var(--muted)}
.raw summary{cursor:pointer;padding:8px 0}
.raw textarea{width:100%;background:#0b1117;color:#aeb9bd;border:1px solid var(--line);border-radius:6px;padding:8px;font:11px/1.35 ui-monospace,Menlo,Consolas,monospace;word-break:break-all;resize:vertical}

.status{min-height:1.4em;margin:0 0 10px;color:var(--muted);font-size:14px}
.status.err{color:var(--warn)}
.how{border-top:1px solid var(--line);padding:16px 0 8px}
.how ol{margin:0;padding-left:20px;color:#b9c3c4;font-size:14px;line-height:1.55}
.how li{margin-bottom:6px}
.how b{color:var(--ink)}

footer{border-top:1px solid var(--line);padding:14px 16px 18px;display:flex;flex-direction:column;gap:6px;color:var(--muted);font-size:11px;line-height:1.5;max-width:560px;margin:0 auto;width:100%}

@media(min-width:700px){
  .intro{padding-top:40px}
  .intro h1{font-size:52px}
  .topbar{padding:0 max(32px,calc((100vw - 560px)/2))}
}
.result.busy .preview-wrap,.result.busy .stats{opacity:.45;transition:opacity .2s}
body.has-photo .intro{display:none}
body.has-photo .pick{margin-top:14px}
.preview-wrap img{max-height:30vh}
@media(min-height:800px){.preview-wrap img{max-height:38vh}}
