:root {
  --ink: #19352f;
  --muted: #677670;
  --paper: #f4f0e7;
  --cream: #fbf9f3;
  --line: #d9d3c7;
  --orange: #e76432;
  --orange-dark: #c54a20;
  --mint: #dce9df;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(231,100,50,.3); outline-offset: 2px; }
.visuallyHidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar { height: 72px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(244,240,231,.94); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 800; letter-spacing: -.03em; }
.brandMark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--ink); color: var(--paper); border-radius: 50%; font-size: 12px; letter-spacing: .04em; }
.privacy { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.privacyDot { width: 8px; height: 8px; border-radius: 50%; background: #4b9d68; box-shadow: 0 0 0 4px #dce9df; }

.hero { padding: 64px 5vw 58px; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 60px; align-items: end; background: var(--cream); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 18px; color: var(--orange-dark); font-size: 11px; font-weight: 900; letter-spacing: .16em; }
h1 { max-width: 870px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(46px, 6.2vw, 86px); line-height: .94; font-weight: 500; letter-spacing: -.055em; }
.lede { max-width: 650px; margin: 28px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.importButton { min-height: 112px; padding: 22px; border: 0; border-radius: 4px; background: var(--orange); color: white; display: flex; align-items: center; gap: 18px; text-align: left; box-shadow: 0 8px 0 #bf4520; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.importButton:hover { transform: translateY(-2px); box-shadow: 0 10px 0 #bf4520; }
.importButton:active { transform: translateY(5px); box-shadow: 0 3px 0 #bf4520; }
.importButton .plus { width: 46px; height: 46px; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; display: grid; place-items: center; font-size: 27px; font-weight: 300; }
.importButton strong, .importButton small { display: block; }
.importButton strong { font-size: 18px; }
.importButton small { opacity: .8; margin-top: 5px; }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: 620px; }
.settingsPanel { padding: 38px 30px 120px 5vw; border-right: 1px solid var(--line); background: #eee9de; }
.sectionHeading { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.sectionHeading span { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--ink); border-radius: 50%; font-family: ui-monospace, monospace; font-size: 10px; font-weight: 800; }
.sectionHeading h2 { margin: 0; font-size: 14px; letter-spacing: .03em; text-transform: uppercase; }
.settingsPanel label, .inspector label { display: block; margin: 0 0 20px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
input:not([type="range"]):not([type="checkbox"]), select { width: 100%; margin-top: 8px; padding: 12px 0; border: 0; border-bottom: 1px solid #aaa79f; border-radius: 0; background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; text-transform: none; letter-spacing: 0; }
select { appearance: auto; }
.outputHeading { margin-top: 40px; }
.value { float: right; color: var(--ink); }
.range { display: block; width: 100%; margin-top: 14px; accent-color: var(--orange); }
.checkRow { display: flex !important; gap: 11px; align-items: flex-start; color: var(--ink) !important; text-transform: none !important; letter-spacing: 0 !important; cursor: pointer; }
.checkRow input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--orange); }
.checkRow strong, .checkRow small { display: block; }
.checkRow small { color: var(--muted); margin-top: 4px; font-weight: 500; }
.tip { margin-top: 28px; padding: 18px; background: var(--mint); border-left: 3px solid #6f9678; }
.tip strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tip p { margin: 7px 0 0; color: #506159; font-size: 12px; line-height: 1.55; }

.stagePanel { padding: 38px 5vw 130px 38px; background: var(--paper); min-width: 0; }
.stageHeader { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.batchStats { color: var(--muted); font-size: 12px; white-space: nowrap; }
.batchStats strong { color: var(--ink); font-size: 22px; margin-right: 4px; }
.batchStats i { display: inline-block; width: 3px; height: 3px; margin: 0 8px 3px; background: var(--orange); border-radius: 50%; }
.emptyStage { width: 100%; min-height: 360px; border: 1px dashed #aaa79f; border-radius: 4px; background: rgba(251,249,243,.7); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.emptyIcon { display: grid; place-items: center; width: 66px; height: 66px; margin-bottom: 20px; border: 1px solid var(--ink); border-radius: 50%; font-size: 28px; }
.emptyStage strong { font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.emptyStage small { max-width: 360px; margin: 10px 20px 20px; color: var(--muted); line-height: 1.5; }
.emptyStage b { color: var(--orange-dark); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.photoGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 16px; }
.photoCard { padding: 8px; border: 1px solid transparent; background: var(--cream); cursor: pointer; transition: border-color .15s, transform .15s; min-width: 0; }
.photoCard:hover { transform: translateY(-2px); }
.photoCard.active { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(231,100,50,.12); }
.photoFrame { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #d9d6ce; }
.photoFrame img { width: 100%; height: 100%; object-fit: contain; transition: transform .2s; }
.sequence { position: absolute; left: 7px; top: 7px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--ink); color: white; border-radius: 50%; font: 700 10px ui-monospace, monospace; }
.cropBadge { position: absolute; right: 7px; bottom: 7px; padding: 5px 7px; background: rgba(251,249,243,.92); color: var(--ink); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.cardMeta { padding: 10px 2px 6px; min-width: 0; }
.cardMeta strong, .cardMeta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cardMeta strong { font-size: 11px; }
.cardMeta small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.cardActions { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.cardActions button { height: 32px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; }
.cardActions button:last-child { border-right: 0; }
.cardActions button:hover { color: var(--orange-dark); }
.cardActions button:disabled { opacity: .25; cursor: default; }
.cardActions .cropAction { color: var(--orange-dark); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.addMore { min-height: 190px; border: 1px dashed #aaa79f; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.addMore span { display: block; font-size: 30px; font-weight: 300; margin-bottom: 8px; }
.splitEditor { margin-top: 26px; padding: 24px; border: 1px solid var(--line); background: var(--cream); }
.splitHeader { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.splitHeader h3 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; word-break: break-all; }
.splitHeader p { margin: 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.splitHeader p strong { color: var(--orange-dark); font-size: 22px; margin-right: 3px; }
.splitSteps { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--orange); background: #fff4ed; color: #665e58; font-size: 12px; line-height: 1.55; }
.splitSteps b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin: 0 4px 0 8px; border-radius: 50%; background: var(--orange); color: white; font-size: 9px; }
.splitSteps b:first-child { margin-left: 0; }
.presetBar { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 12px; background: #eee9de; }
.presetBar > span { margin-right: 5px; color: var(--muted); font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.presetBar button { padding: 8px 10px; border: 1px solid #b8b3a9; background: var(--cream); cursor: pointer; font-size: 10px; font-weight: 800; }
.presetBar button:hover { border-color: var(--orange); color: var(--orange-dark); }
.gutterControl { display: flex !important; align-items: center; gap: 12px; margin: 15px 0 !important; }
.gutterControl span { color: var(--ink); min-width: 28px; }
.gutterControl input { flex: 1; accent-color: var(--orange); }
.cropSurface { position: relative; width: min(100%, 860px); margin: 0 auto; background: #282d2b; line-height: 0; overflow: hidden; user-select: none; }
.cropSurface > img { display: block; width: 100%; height: auto; }
.cropOverlay { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.cropLoading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(25,53,47,.84); color: white; font-size: 12px; line-height: 1.4; }
.cropBox { position: absolute; border: 2px solid #fff; background: rgba(231,100,50,.08); box-shadow: 0 0 0 1px rgba(25,53,47,.6); cursor: move; }
.cropBox.selected { border-color: #ff7040; box-shadow: 0 0 0 2px #fff; }
.cropBox > span { position: absolute; left: 5px; top: 5px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--orange); color: white; font: 800 10px ui-monospace, monospace; line-height: 1; }
.cropBox > button { position: absolute; right: 4px; top: 4px; width: 27px; height: 27px; border: 0; border-radius: 50%; background: rgba(25,53,47,.86); color: white; cursor: pointer; font-size: 18px; line-height: 1; }
.cropBox > i { position: absolute; right: -7px; bottom: -7px; width: 22px; height: 22px; border: 3px solid white; border-radius: 50%; background: var(--orange); cursor: nwse-resize; }
.cropHelp { max-width: 760px; margin: 15px auto 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.cropHelp strong { color: var(--ink); }
.splitEditor + .emptyStage, .splitEditor + .emptyStage + .photoGrid { margin-top: 22px; }
.inspector { margin-top: 24px; padding: 18px 20px; display: grid; grid-template-columns: minmax(150px, .7fr) minmax(220px, 1.3fr) auto; gap: 24px; align-items: end; background: var(--ink); color: white; }
.inspectorLabel { display: block; margin-bottom: 7px; color: #a8bcb5; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.inspector > div strong { font-size: 12px; word-break: break-all; }
.inspector label { margin: 0; color: #a8bcb5; }
.inspector input:not([type="range"]) { color: white; border-color: #58716a; }
.inspector input::placeholder { color: #829891; }
.removeButton { height: 42px; padding: 0 16px; border: 1px solid #7f948e; background: transparent; color: white; cursor: pointer; font-size: 11px; font-weight: 800; text-transform: uppercase; }

.exportBar { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; min-height: 88px; padding: 14px 5vw; display: flex; align-items: center; gap: 24px; background: var(--ink); color: white; box-shadow: 0 -8px 30px rgba(25,53,47,.12); }
.status { flex: 1; display: flex; align-items: center; min-width: 0; }
.status span { min-width: 70px; color: #9fc0b6; font: 800 10px ui-monospace, monospace; text-transform: uppercase; letter-spacing: .08em; }
.status p { margin: 0; color: #d1ddd9; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clearButton { padding: 12px 4px; border: 0; border-bottom: 1px solid #81958f; background: transparent; color: #d1ddd9; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.exportButton { width: min(280px, 35vw); height: 58px; border: 0; background: var(--orange); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 22px; cursor: pointer; font-weight: 800; }
.exportButton b { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; font-size: 13px; }
.exportButton:disabled { opacity: .4; cursor: default; }

@media (max-width: 780px) {
  .topbar { height: 62px; padding: 0 18px; }
  .privacy { font-size: 9px; }
  .hero { padding: 42px 20px 38px; grid-template-columns: 1fr; gap: 34px; }
  h1 { font-size: clamp(44px, 13vw, 64px); }
  .lede { font-size: 15px; }
  .importButton { width: 100%; min-height: 92px; }
  .workspace { display: block; }
  .settingsPanel { padding: 30px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stagePanel { padding: 32px 20px 180px; }
  .photoGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .splitEditor { padding: 14px; margin-left: -6px; margin-right: -6px; }
  .splitHeader { display: block; }
  .splitHeader p { margin-top: 10px; }
  .inspector { grid-template-columns: 1fr; gap: 14px; }
  .exportBar { min-height: 126px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 10px 14px; }
  .status { flex-basis: 100%; }
  .status p { white-space: normal; line-height: 1.3; }
  .clearButton { margin-left: auto; }
  .exportButton { width: 62%; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
