:root {
  color-scheme: light dark;
  --paper: #edf1f5;
  --page-glow: #d5e2ee;
  --ink: var(--glass-tint-ink);
  --muted: var(--glass-tint-muted);
  --chrome: #e8eff5;
  --panel: #f4f8fb;
  --control: #e0e9f1;
  --control-hover: #d4e1ec;
  --edge: #cad7e2;
  --stage: #314656;
  --brand-red: #c91f28;
  --action-red: #c91f28;
  --action-hover: #aa1821;
  --selected: #f9e8eb;
  --selected-edge: #edb8be;
  --selected-ink: #a51b24;
  --focus: var(--glass-focus);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #10161e;
    --page-glow: #223649;
    --chrome: #293d4e;
    --panel: #32495c;
    --control: #3b5368;
    --control-hover: #47637a;
    --edge: #536b80;
    --stage: #304455;
    --brand-red: #ff6970;
    --selected: #53343e;
    --selected-edge: #a96570;
    --selected-ink: #ffc0c5;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 12% 0%, var(--page-glow), transparent 38rem), var(--paper);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
button:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, canvas:focus-visible, .file-picker:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

svg {
  width: 19px;
  height: 19px;
  flex: none;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }

.glass {
  --glass-x: 20%;
  --glass-y: 0%;
  --glass-light: .38;
  position: relative;
  isolation: isolate;
  border: 1px solid transparent;
}
.glass::before, .glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
}
.glass::after { inset: 1px; border: 1px solid transparent; }

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  margin-top: 18px;
  padding: 8px 16px;
  border-radius: 23px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -.045em;
}
.brand img {
  width: 44px;
  height: 44px;
  flex: none;
  object-fit: contain;
  background: #f5f7fa;
  border-radius: 50%;
}
.brand-period { color: var(--brand-red); }
.mast-tag, .eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.mast-tag {
  padding: 5px 10px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}
.intro { padding: 34px 3px 24px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 9px; color: var(--brand-red); }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
.intro h1 {
  margin: 0 0 10px;
  font-size: clamp(31px, 4vw, 49px);
  font-weight: 530;
  line-height: 1.08;
  letter-spacing: -.052em;
}
.intro p:last-child { margin: 0; color: var(--muted); }

.editor {
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: var(--chrome);
  box-shadow: 0 18px 48px rgba(29, 49, 70, .14);
}
.toolbar {
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(135deg, var(--panel), var(--chrome));
}
.group { display: flex; align-items: center; gap: 4px; }
.toolbar > .group:last-child { margin-left: auto; }
.split { height: 24px; border-left: 1px solid var(--edge); }
.tool, .mini, .download, .primary, .secondary, .menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: inherit;
  white-space: nowrap;
}
.tool { width: 40px; height: 40px; }
.tool svg { width: 18px; height: 18px; }
.tool:hover:not(:disabled), .mini:hover:not(:disabled), .secondary:hover, .menu button:hover {
  background: var(--control-hover);
}
.tool[aria-pressed="true"], .tool[aria-expanded="true"] {
  border-color: var(--selected-edge);
  background: var(--selected);
  color: var(--selected-ink);
}
.file-picker { position: relative; overflow: hidden; cursor: pointer; }
.file-picker input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.file-picker input::file-selector-button { width: 100%; height: 100%; cursor: pointer; }
.download, .primary { min-height: 40px; padding: 7px 13px; font-size: 14px; font-weight: 700; }
.download { border-color: var(--edge); background: var(--control); }
.download:not(:disabled):hover { background: var(--control-hover); }
.download.full, .primary { border-color: transparent; background: var(--action-red); color: #fff; }
.download.full:not(:disabled):hover, .primary:not(:disabled):hover { background: var(--action-hover); }
.download svg, .primary svg { width: 16px; height: 16px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  z-index: 8;
  min-width: 145px;
  padding: 5px;
  transform: translateX(-50%);
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(16, 32, 47, .22);
}
.menu button { justify-content: flex-start; width: 100%; min-height: 34px; padding: 6px 9px; font-size: 13px; }
.pop-menu { left: auto; right: 0; width: min(240px, calc(100vw - 60px)); padding: 11px 13px; transform: none; }
.pop-menu > strong { font-size: 15px; }
.pop-menu > p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

.batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 10px;
  padding: 5px 13px;
  border-bottom: 1px solid var(--edge);
  background: var(--selected);
  color: var(--selected-ink);
  font-size: 14px;
  font-weight: 650;
}
.batch-bar .mini, .photo-rail-head .mini { border-color: var(--edge); background: var(--panel); }
.batch-bar .mini:hover:not(:disabled), .photo-rail-head .mini:hover:not(:disabled) { background: var(--control-hover); }

.body { display: flex; min-height: 420px; height: clamp(420px, 59vh, 740px); }
.photo-rail {
  display: flex;
  flex: 0 0 148px;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--edge);
  background: linear-gradient(160deg, var(--panel), var(--chrome));
}
.photo-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 8px 9px;
  border-bottom: 1px solid var(--edge);
  font-size: 14px;
}
.photo-rail-head strong { min-width: 0; }
.photo-rail-head strong span { margin-left: 3px; color: var(--muted); font-weight: 500; }
.photo-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  margin: 0;
  padding: 8px;
  overflow: auto;
  list-style: none;
  scrollbar-width: thin;
}
.photo-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: inherit;
}
.photo-thumb:hover { background: var(--control); }
.photo-thumb[aria-current="true"], .photo-thumb[aria-pressed="true"] {
  border-color: var(--selected-edge);
  background: var(--selected);
}
.photo-thumb[aria-disabled="true"] { cursor: wait; }
.photo-thumb img {
  display: block;
  width: 100%;
  height: 74px;
  border-radius: 5px;
  background: var(--stage);
  object-fit: contain;
}
.photo-name {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: 13px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photo-check {
  position: absolute;
  top: 9px;
  right: 9px;
  display: none;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--panel);
  color: transparent;
  font-size: 14px;
  font-weight: 700;
}
.photo-thumb[aria-pressed] .photo-check { display: grid; }
.photo-thumb[aria-pressed="true"] .photo-check { border-color: transparent; background: var(--action-red); color: #fff; }

.stage {
  position: relative;
  display: grid;
  flex: 1;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  background-color: var(--stage);
  background-image: radial-gradient(rgba(194, 215, 235, .2) 1px, transparent 1px);
  background-size: 22px 22px;
}
.stage.dragover::after {
  content: "Drop your photos here";
  position: absolute;
  inset: 12px;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed #ffabb2;
  border-radius: 15px;
  background: rgba(27, 44, 59, .86);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  pointer-events: none;
}
canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.welcome {
  width: min(410px, calc(100% - 32px));
  padding: 27px 24px 24px;
  border-radius: 22px;
  text-align: center;
}
.welcome-icon {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  margin: 0 auto 12px;
  border: 1px solid var(--selected-edge);
  border-radius: 14px;
  background: var(--selected);
  color: var(--selected-ink);
}
.welcome-icon svg { width: 25px; height: 25px; }
.welcome p { margin: 0 0 17px; color: var(--muted); font-size: 15px; }
.welcome .primary { min-height: 44px; padding-inline: 17px; }
.welcome small { display: block; margin-top: 12px; color: var(--muted); font-size: 13px; }
.finish {
  position: absolute;
  bottom: 13px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: max-content;
  max-width: calc(100% - 16px);
  gap: 6px;
  padding: 5px;
  transform: translateX(-50%);
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 5px 18px rgba(16, 32, 47, .2);
}
.finish .primary { min-height: 36px; padding: 4px 11px; }

.inspector {
  width: 256px;
  flex: 0 0 256px;
  overflow: auto;
  padding: 0 15px 14px;
  border-left: 1px solid var(--edge);
  background: var(--panel);
}
.inspector-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-block: 9px;
  border-bottom: 1px solid var(--edge);
  background: var(--panel);
}
.inspector-header strong { font-size: 15px; }
.inspector h3 { margin: 0 0 9px; color: var(--selected-ink); font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 9px 0; font-size: 14px; }
.field.stacked { display: grid; grid-template-columns: 1fr auto; }
.field.stacked input[type="range"], .field.stacked input[type="text"] { grid-column: 1 / -1; width: 100%; margin: 0; }
.field output { color: var(--muted); font: 12px ui-monospace, monospace; }
.field input, .field select { accent-color: var(--brand-red); }
.field input[role="switch"] {
  appearance: none;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  display: grid;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--muted);
  border-radius: 20px;
  background: var(--control);
  cursor: pointer;
}
.field input[role="switch"]::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
}
.field input[role="switch"]:checked { border-color: var(--action-red); background: var(--action-red); }
.field input[role="switch"]:checked::before { justify-self: end; background: #fff; }
.field input[role="switch"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (forced-colors: active) {
  .field input[role="switch"] { appearance: auto; }
  .field input[role="switch"]::before { content: none; }
}
.field input[type="color"] { width: 39px; height: 29px; padding: 2px; border: 1px solid var(--edge); border-radius: 6px; background: var(--control); }
.field input[type="text"], .field input[type="number"], .field select { min-width: 0; padding: 5px 7px; border: 1px solid var(--edge); border-radius: 7px; background: var(--control); color: var(--ink); }
.field input[type="number"] { width: 75px; }
.inspector hr { margin: 12px 0; border: 0; border-top: 1px solid var(--edge); }
.segments { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.segments button { border-color: var(--edge); }

.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 6px 13px;
  border-top: 1px solid var(--edge);
  background: var(--chrome);
  color: var(--muted);
  font-size: 13px;
}
.hint { display: flex; align-items: center; gap: 8px; }
.hint::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--brand-red); }
.file-info { overflow: hidden; max-width: 45%; margin-left: auto; white-space: nowrap; text-overflow: ellipsis; }
.zoom { display: flex; align-items: center; gap: 3px; }
.mini, .secondary { min-height: 32px; padding: 0 9px; font-size: 13px; }
.mini svg { width: 15px; height: 15px; }
.under { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin: 16px 2px 28px; color: var(--muted); font-size: 14px; }
.under p { margin: 0; }
.under details { text-align: right; }
.under summary { cursor: pointer; color: var(--brand-red); font-weight: 650; }
.under details p { max-width: 420px; margin-top: 7px; }
kbd { padding: 1px 5px; border: 1px solid var(--edge); border-radius: 5px; background: var(--panel); color: var(--ink); font: 12px ui-monospace, monospace; }

@media (max-width: 720px) {
  .shell { width: calc(100% - 24px); }
  .masthead { min-height: 59px; margin-top: 12px; padding-inline: 11px; border-radius: 19px; }
  .brand { gap: 7px; font-size: 17px; }
  .brand img { width: 37px; height: 37px; }
  .mast-tag { padding-inline: 8px; font-size: 11px; }
  .intro { padding: 25px 2px 20px; }
  .editor { border-radius: 19px; }
  .toolbar { justify-content: center; gap: 5px; padding: 8px; }
  .split { display: none; }
  .group { gap: 3px; }
  .toolbar > .group:last-child { margin-left: 0; }
  .tool { width: 36px; height: 39px; }
  .body { flex-direction: column; height: auto; min-height: 0; }
  .photo-rail { flex: auto; border-right: 0; border-bottom: 1px solid var(--edge); }
  .photo-rail-head { padding: 5px 10px; }
  .photo-rail-head .mini { min-height: 36px; }
  .photo-list { flex-direction: row; }
  .photo-list li { flex: 0 0 110px; min-width: 0; }
  .photo-thumb img { height: 60px; }
  .stage { flex: auto; height: min(56vh, 480px); min-height: 350px; }
  .welcome { padding: 22px 18px; }
  .inspector { width: auto; max-height: 290px; flex: auto; border-top: 1px solid var(--edge); border-left: 0; }
  .statusbar { flex-wrap: wrap; }
  .file-info { max-width: 55%; }
  .under { flex-direction: column; }
  .under details { text-align: left; }
}

.labeled-tool { width: auto; padding-inline: 9px; font-size: 13px; font-weight: 700; }
.crop-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 12px;
  padding: 5px 13px;
  border-bottom: 1px solid var(--edge);
  background: var(--panel);
}
.crop-controls .field { margin: 4px 0; }
.crop-controls select { min-height: 36px; }
.crop-rotation { display: flex; gap: 4px; }
.crop-rotation button { min-height: 36px; white-space: nowrap; }
.crop-angle input { width: clamp(80px, 12vw, 144px); min-height: 36px; margin: 0; }
.crop-angle output { min-width: 6ch; text-align: right; }
#crop-size { color: var(--muted); font: 12px ui-monospace, monospace; }
.crop-actions { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-left: auto; }
.crop-actions .primary { min-height: 36px; }
.adjustment-sliders .field { margin: 0 0 12px; gap: 3px 6px; }
.adjustment-sliders input { min-height: 22px; }
#adjustments > .secondary { border-color: var(--edge); }

@media (max-width: 720px) {
  .crop-actions { margin-left: 0; }
  .adjustment-sliders { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 15px; }
  .adjustment-sliders input { min-height: 34px; }
}
