:root {
  color-scheme: light;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --page: #f2f1ed;
  --surface: #fbfbf8;
  --surface-strong: #ffffff;
  --ink: #161715;
  --muted: #62645f;
  --line: #cecec7;
  --line-strong: #73776f;
  --accent: #2a6956;
  --accent-dark: #174a3c;
  --danger: #a33131;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
}

button,
input {
  font: inherit;
}

button,
label[for="file-input"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
}

#file-input:focus-visible + label {
  outline: 3px solid var(--accent-dark);
  outline-offset: 3px;
}

.site-header,
main,
footer {
  width: min(100% - 40px, 1480px);
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 10px;
  font: 800 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

main {
  padding: clamp(52px, 6vw, 92px) 0 80px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: end;
  gap: 56px;
  margin-bottom: 56px;
}

.eyebrow,
.step-label {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font: 750 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  text-wrap: pretty;
}

h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(48px, 6vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.intro-copy {
  max-width: 48ch;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.trust-line {
  margin-top: 14px;
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 0.82fr) minmax(520px, 1.18fr);
  min-height: 760px;
  overflow: clip;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

.controls-panel,
.preview-panel {
  padding: clamp(24px, 3vw, 42px);
}

.controls-panel {
  border-right: 1px solid var(--line);
}

.preview-panel {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  background: #e6e5df;
}

.panel-heading,
.preview-heading,
.dialog-heading,
.dialog-actions,
.shot-header,
.shot-actions,
.sample-row,
.range-control > span,
.color-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.text-button,
.close-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: none;
  font-weight: 720;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.text-button.danger {
  color: var(--danger);
}

.drop-zone {
  margin-top: 28px;
  padding: 36px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, white);
  transform: translateY(-2px);
}

#file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.primary-button,
.secondary-button,
.export-button,
.close-button {
  min-height: 44px;
  border-radius: 10px;
}

.primary-button,
.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid var(--accent-dark);
  color: #f7fbf8;
  background: var(--accent-dark);
  font-weight: 760;
  cursor: pointer;
}

.primary-button:active,
.secondary-button:active,
.export-button:active,
.text-button:active {
  transform: translateY(1px);
}

.drop-zone p {
  margin: 18px 0 5px;
  color: var(--muted);
  font-size: 14px;
}

.drop-zone span {
  color: var(--muted);
  font-size: 13px;
}

.sample-row {
  padding: 18px 2px 14px;
  color: var(--muted);
  font-size: 14px;
}

.message {
  min-height: 21px;
  margin: 0 0 6px;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.message.success {
  color: var(--accent-dark);
}

.shot-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shot-card {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.shot-card[draggable="true"] {
  cursor: grab;
}

.shot-card.is-dragging {
  opacity: 0.45;
}

.shot-thumb {
  width: 138px;
  height: 104px;
  display: block;
  border-radius: 10px;
  background: #deded8;
  object-fit: contain;
}

.shot-body {
  min-width: 0;
}

.shot-number {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--accent-dark);
  font: 750 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.shot-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caption-label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.caption-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

.caption-input::placeholder {
  color: #6b6e68;
}

.shot-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 12px;
  gap: 8px;
}

.shot-actions button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  color: var(--accent-dark);
  background: none;
  font-size: 12px;
  font-weight: 730;
  cursor: pointer;
}

.shot-actions .remove-shot {
  margin-left: auto;
  color: var(--danger);
}

.settings {
  display: grid;
  gap: 22px;
  margin: 30px 0 0;
  padding: 24px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.settings legend {
  margin-bottom: 18px;
  padding: 0;
  font-size: 16px;
  font-weight: 760;
}

.setting-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.setting-grid > label,
.range-control {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.color-control {
  justify-content: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
}

input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
}

.color-control output,
.range-control output,
.preview-heading output {
  color: var(--ink);
  font: 650 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--accent-dark);
}

.preview-heading output {
  color: var(--muted);
}

.canvas-shell {
  min-height: 590px;
  max-height: 68vh;
  margin-top: 28px;
  padding: 24px;
  overflow: auto;
  border: 1px solid #c4c4bd;
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #d3d3cd 25%, transparent 25%),
    linear-gradient(-45deg, #d3d3cd 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d3d3cd 75%),
    linear-gradient(-45deg, transparent 75%, #d3d3cd 75%),
    #ddddD7;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.empty-preview {
  min-height: 540px;
  display: grid;
  place-content: center;
  gap: 7px;
  padding: 24px;
  color: var(--ink);
  text-align: center;
}

.empty-preview strong {
  color: var(--ink);
  font-size: 18px;
}

#preview-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(47, 52, 45, 0.12);
}

.export-button {
  width: 100%;
  margin-top: 18px;
  font-size: 16px;
}

.privacy-note {
  max-width: 62ch;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.how-it-works {
  max-width: 1000px;
  margin: 56px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.how-it-works ol {
  margin: 20px 0 0;
  padding-left: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.how-it-works li {
  padding-right: 16px;
  line-height: 1.55;
}

.how-it-works li::marker {
  color: var(--accent-dark);
  font-weight: 750;
}

footer {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--accent-dark);
  font-weight: 720;
}

dialog {
  width: min(100% - 28px, 1120px);
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 38px rgba(31, 34, 29, 0.18);
}

dialog::backdrop {
  background: rgba(24, 26, 23, 0.66);
  backdrop-filter: blur(3px);
}

.dialog-card {
  padding: clamp(22px, 4vw, 42px);
}

.dialog-help {
  max-width: 70ch;
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.5;
}

.close-button {
  min-width: 44px;
  min-height: 44px;
  color: var(--muted);
}

.redaction-stage {
  display: grid;
  max-height: 62vh;
  overflow: auto;
  place-items: center;
  padding: 18px;
  border-radius: var(--radius);
  background: #d8d8d2;
}

#redaction-canvas {
  max-width: 100%;
  height: auto;
  display: block;
  background: white;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 12px 38px rgba(31, 34, 29, 0.18);
}

#redaction-canvas:focus-visible {
  outline: 4px solid var(--accent-dark);
  outline-offset: 4px;
}

.dialog-actions {
  margin-top: 20px;
}

.dialog-actions > div {
  display: flex;
  gap: 10px;
}

.secondary-button {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: white;
  font-weight: 720;
  cursor: pointer;
}

button:disabled,
fieldset:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 1040px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-panel {
    position: static;
  }

  .canvas-shell {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  footer {
    width: min(100% - 24px, 1480px);
  }

  .site-header p {
    display: none;
  }

  main {
    padding-top: 42px;
  }

  h1 {
    font-size: clamp(42px, 14vw, 64px);
  }

  .workspace {
    min-height: 0;
  }

  .controls-panel,
  .preview-panel {
    padding: 22px 16px;
  }

  .panel-heading,
  .preview-heading {
    align-items: flex-start;
  }

  .sample-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .shot-card {
    grid-template-columns: 1fr;
  }

  .shot-thumb {
    width: 100%;
    height: 160px;
  }

  .setting-grid {
    grid-template-columns: 1fr;
  }

  .how-it-works ol {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .canvas-shell {
    min-height: 360px;
    padding: 12px;
  }

  .empty-preview {
    min-height: 330px;
  }

  .dialog-heading,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-heading .close-button {
    align-self: flex-end;
  }

  .dialog-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #clear-redactions {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
