/* Labclone Photo · a bright, calm workshop. Neutral chrome, a light pasteboard, ember only where you act. */
:root {
  --bg: #FFFFFF;
  --pane: #F8F9FA;
  --pane-2: #F1F3F4;
  --board: #E9EAED;
  --fg: #202124;
  --fg-2: #5F6368;
  --fg-3: #80868B;
  --hair: #DADCE0;
  --link: #C2410C;
  --orange: #F2711E;
  --red: #E5321B;
  --ember: linear-gradient(120deg, #F9B44A 0%, #F2711E 48%, #E5321B 100%);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 8px; }

.app { height: 100dvh; display: grid; grid-template-columns: 56px minmax(0, 1fr) 300px; grid-template-rows: 56px 46px minmax(0, 1fr) 28px; grid-template-areas: "top top top" "opt opt panels" "tools stage panels" "status status status"; }

/* ---------- Top bar ---------- */
.top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--hair); background: #fff; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); text-decoration: none; font: 800 14px/1 "Archivo", var(--sans); font-stretch: 118%; text-transform: uppercase; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--link); font-weight: 800; }
.bmark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 800 14px/1 "Archivo", var(--sans); box-shadow: 0 0 0 1px rgb(0 0 0 / .06); }
.mark { width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .06); stroke: none; }
.docname { font: 500 12px var(--mono); color: var(--fg-2); padding: 6px 10px; border-radius: 8px; background: var(--pane); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sep { width: 1px; height: 24px; background: var(--hair); margin: 0 4px; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zv { border: 0; background: none; font: 500 12px var(--mono); min-width: 54px; height: 32px; border-radius: 8px; cursor: pointer; }
.zv:hover { background: var(--pane-2); }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border: 0; border-radius: 10px; cursor: pointer; font-weight: 600; white-space: nowrap; transition: transform .25s var(--spring), filter .2s, background-color .2s; }
.btn:active { transform: scale(.97); }
.btn.ember { background: var(--ember); color: var(--on-accent, #202124); box-shadow: 0 6px 18px -8px rgb(229 50 27 / .6); }
.btn.ember:hover { filter: saturate(1.15) brightness(1.03); }
.btn.quiet { background: var(--pane-2); }
.btn.quiet:hover { background: var(--hair); }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
.btn.wide { width: 100%; justify-content: center; margin-top: 12px; }
.ib { width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; color: var(--fg); transition: background-color .15s; }
.ib.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 18px; }
.ib.sm svg { width: 16px; height: 16px; }
.ib:hover { background: var(--pane-2); }
.ib:disabled { opacity: .35; cursor: default; background: none; }

/* ---------- Options bar ---------- */
.options { grid-area: opt; display: flex; align-items: center; gap: 18px; padding: 0 14px; border-bottom: 1px solid var(--hair); background: #fff; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.options .t { font-weight: 600; }
.options label { display: inline-flex; align-items: center; gap: 8px; color: var(--fg-2); }
.options input[type="range"] { width: 120px; }
.options output, .op output, .sl output, .q output { font: 500 12px var(--mono); color: var(--fg); min-width: 38px; }
.options select { height: 30px; border: 1px solid var(--hair); border-radius: 8px; background: #fff; padding: 0 8px; }
.options .hint { color: var(--fg-3); }
input[type="range"] { accent-color: var(--orange); }

/* ---------- Tools rail ---------- */
.tools { grid-area: tools; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; border-right: 1px solid var(--hair); background: #fff; }
.tb { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; cursor: pointer; color: var(--fg-2); transition: background-color .15s, color .15s, transform .25s var(--spring); }
.tb:hover { background: var(--pane-2); color: var(--fg); }
.tb.on { background: var(--fg); color: #fff; }
.tb.on svg { stroke: #fff; }
.tb:active { transform: scale(.94); }
.colors { position: relative; width: 40px; height: 48px; margin-top: 12px; }
.sw { position: absolute; width: 26px; height: 26px; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--hair); cursor: pointer; }
.sw input { position: absolute; inset: -8px; width: 44px; height: 44px; border: 0; padding: 0; cursor: pointer; }
.sw.fg { left: 0; top: 0; z-index: 2; }
.sw.bg { right: 0; bottom: 0; }
.swap { position: absolute; right: -2px; top: -2px; width: 18px; height: 18px; border: 0; background: none; padding: 0; color: var(--fg-3); cursor: pointer; }
.swap svg { width: 14px; height: 14px; }

/* ---------- Stage ---------- */
.stage { grid-area: stage; position: relative; overflow: hidden; background: var(--board); touch-action: none; }
.doc { position: absolute; left: 0; top: 0; transform-origin: 0 0; isolation: isolate; box-shadow: 0 0 0 1px rgb(0 0 0 / .08), 0 18px 50px -20px rgb(32 33 36 / .35);
  background-color: #fff; background-image: linear-gradient(45deg, #E6E7EA 25%, transparent 25%), linear-gradient(-45deg, #E6E7EA 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #E6E7EA 75%), linear-gradient(-45deg, transparent 75%, #E6E7EA 75%);
  background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.doc canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: auto; }
.doc canvas.moving { will-change: transform; }
.crop-box { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 9999px rgb(32 33 36 / .5), inset 0 0 0 1px rgb(0 0 0 / .4); pointer-events: none; z-index: 50; }
.crop-box::before, .crop-box::after { content: ""; position: absolute; inset: 33.33% 0; border-block: 1px solid rgb(255 255 255 / .5); }
.crop-box::after { inset: 0 33.33%; border-block: 0; border-inline: 1px solid rgb(255 255 255 / .5); }
.cursor { position: absolute; left: 0; top: 0; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .55); pointer-events: none; display: none; z-index: 60; }
.stage.c-brush, .stage.c-eraser { cursor: none; }
.stage.c-hand { cursor: grab; }
.stage.c-hand.drag { cursor: grabbing; }
.stage.c-crop, .stage.c-eyedropper, .stage.c-text { cursor: crosshair; }
.stage.c-text { cursor: text; }
.stage.c-move { cursor: move; }

.drop { position: absolute; inset: 14px; z-index: 80; border-radius: 22px; display: grid; place-items: center; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
  background: radial-gradient(closest-side, rgb(247 168 58 / .28), rgb(242 113 30 / .1) 60%, transparent), rgb(255 255 255 / .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: inset 0 0 0 2px var(--orange); }
.drop div { display: grid; justify-items: center; gap: 6px; }
.drop .mark { width: 56px; height: 56px; margin-bottom: 8px; }
.drop b { font: 800 26px/1 "Archivo", var(--sans); font-stretch: 118%; text-transform: uppercase; }
.drop span { color: var(--fg-2); }
.app.dragging .drop { opacity: 1; }

/* ---------- Panels ---------- */
.panels { grid-area: panels; display: flex; flex-direction: column; border-left: 1px solid var(--hair); background: #fff; min-height: 0; overflow-y: auto; }
.panel { padding: 14px 16px 16px; border-bottom: 1px solid var(--hair); }
.panel.grow { flex: 1; display: flex; flex-direction: column; min-height: 220px; border-bottom: 0; }
.panel header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel h2 { margin: 0; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--fg-2); }
.link { border: 0; background: none; color: var(--link); cursor: pointer; font-weight: 500; padding: 4px; }
.presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 12px; padding: 2px; }
.presets button { flex: none; border: 0; cursor: pointer; padding: 0; background: none; display: grid; gap: 5px; justify-items: center; font-size: 11px; color: var(--fg-2); }
.presets canvas { width: 54px; height: 40px; border-radius: 8px; box-shadow: 0 0 0 1px var(--hair); transition: box-shadow .2s, transform .25s var(--spring); }
.presets button:hover canvas { transform: translateY(-2px); }
.presets button.on canvas { box-shadow: 0 0 0 2px var(--orange); }
.presets button.on { color: var(--fg); }
.sliders { display: grid; gap: 8px; }
.sl { display: grid; grid-template-columns: 96px minmax(0, 1fr) 40px; align-items: center; gap: 8px; color: var(--fg-2); }
.sl input { width: 100%; }
.sl output { text-align: right; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.row4 .ib { width: 100%; background: var(--pane); }
.row4 .ib:hover { background: var(--pane-2); }
.row-ib { display: flex; gap: 0; }
.lprops { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.lprops select { height: 32px; border: 1px solid var(--hair); border-radius: 8px; background: #fff; padding: 0 8px; }
.op { display: grid; grid-template-columns: 56px minmax(0, 1fr) 40px; align-items: center; gap: 8px; color: var(--fg-2); }
.op output { text-align: right; }
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; overflow-y: auto; min-height: 0; }
.layer { display: grid; grid-template-columns: 30px 44px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px; border-radius: 10px; cursor: pointer; transition: background-color .15s; }
.layer:hover { background: var(--pane); }
.layer.on { background: var(--pane-2); box-shadow: inset 0 0 0 1px var(--hair); }
.layer .vis { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--fg-2); }
.layer .vis:hover { background: #fff; }
.layer.hidden-layer .name, .layer.hidden-layer canvas { opacity: .4; }
.layer canvas { width: 44px; height: 33px; border-radius: 6px; box-shadow: 0 0 0 1px var(--hair); background: repeating-conic-gradient(#E6E7EA 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.layer .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.layer .name small { display: block; font: 500 10px var(--mono); color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Status ---------- */
.status { grid-area: status; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 14px; border-top: 1px solid var(--hair); font: 500 11px var(--mono); color: var(--fg-3); background: #fff; white-space: nowrap; overflow: hidden; }

/* ---------- Export sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgb(32 33 36 / .35); animation: fade .2s var(--ease); padding: 16px; }
@keyframes fade { from { opacity: 0; } }
.sheet-card { width: min(100%, 380px); background: rgb(255 255 255 / .92); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); border-radius: 22px; padding: 24px; display: grid; gap: 16px; box-shadow: inset 0 1px 0 #fff, 0 30px 80px -20px rgb(0 0 0 / .4); animation: pop .35s var(--spring); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.sheet-card h2 { margin: 0; font: 800 22px/1 "Archivo", var(--sans); font-stretch: 112%; text-transform: uppercase; }
.seg2 { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; border-radius: 12px; background: var(--pane-2); }
.seg2 label { position: relative; cursor: pointer; }
.seg2 input { position: absolute; opacity: 0; }
.seg2 span { display: block; text-align: center; padding: 8px 0; border-radius: 9px; font-weight: 600; color: var(--fg-2); transition: background-color .2s, color .2s; }
.seg2 input:checked + span { background: #fff; color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.seg2 input:focus-visible + span { outline: 2px solid var(--orange); }
.q { display: grid; grid-template-columns: 64px minmax(0, 1fr) 36px; align-items: center; gap: 10px; color: var(--fg-2); }
.hint { margin: 0; color: var(--fg-3); font-size: 13px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Toast + text input ---------- */
.toast { position: fixed; left: 50%; bottom: 44px; z-index: 120; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 999px; background: var(--fg); color: #fff; font-weight: 500; transition: opacity .25s var(--ease), transform .25s var(--ease); white-space: nowrap; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.text-input { position: fixed; z-index: 90; min-width: 180px; padding: 6px 10px; border: 2px solid var(--orange); border-radius: 8px; background: rgb(255 255 255 / .95); font-weight: 600; outline: none; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .3); }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: 52px 44px minmax(0, 1fr) auto 26px; grid-template-areas: "top top" "opt opt" "tools stage" "panels panels" "status status"; }
  .panels { border-left: 0; border-top: 1px solid var(--hair); flex-direction: row; overflow-x: auto; max-height: 34dvh; }
  .panel { min-width: 270px; border-bottom: 0; border-right: 1px solid var(--hair); }
  .docname, .hide-sm, .top .btn span { display: none; }
  .top .btn { padding: 0 10px; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
