:root {
  --bg: #efeae2;
  --paper: #f7f3ec;
  --ink: #1b1814;
  --muted: #6f675d;
  --line: #d8d0c4;
  --accent: #8c3a1d;
  --accent-ink: #fffaf4;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  word-spacing: normal;
  min-height: 100vh;
}

main {
  width: min(1040px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 80px;
}

header { margin-bottom: 36px; max-width: 36rem; }
.mark {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.lede { margin: 0; color: var(--muted); }

.drop {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 180px;
  padding: 28px;
  background: var(--paper);
  border: 1px dashed var(--line);
  cursor: pointer;
}
.drop.over { border-color: var(--ink); background: #fff; }
.drop input { display: none; }
.drop-title { font-size: 1.05rem; }
.drop-hint { margin-top: 6px; color: var(--muted); font-size: 0.88rem; }

.row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.row label { display: flex; flex-direction: column; gap: 6px; }
.slider-wrap {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid var(--line);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.slider-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.slider-name { font-size: 0.9rem; }
.slider-value { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.slider-hint { display: block; margin-top: 8px; color: var(--muted); font-size: 0.78rem; }
.slider-wrap input[type=range] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: var(--line);
  touch-action: pan-y;
}
.slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
}
.slider-wrap input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
}
.slider-ticks span {
  color: var(--muted);
  text-align: center;
  min-width: 1.4em;
  transition: color 0.15s;
}
/* size ramp: smallest left, biggest right */
.slider-ticks span:nth-child(1) { font-size: 0.66rem; }
.slider-ticks span:nth-child(2) { font-size: 0.76rem; }
.slider-ticks span:nth-child(3) { font-size: 0.88rem; }
.slider-ticks span:nth-child(4) { font-size: 1.02rem; }
.slider-ticks span:nth-child(5) { font-size: 1.18rem; font-weight: 600; }
.slider-ticks span.on { color: var(--ink); }

.row label.opt {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.row label.opt input[type=checkbox] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  flex: 0 0 auto;
  accent-color: var(--ink);
}
.row label.opt span { text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.row label.opt em { flex-basis: 100%; color: var(--muted); font-size: 0.78rem; font-style: normal; }
.row label.opt select { flex: 0 0 auto; width: auto; min-width: 180px; }

.exif-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  padding: 12px 14px;
}
.exif-box summary {
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.exif-box summary span { color: var(--muted); font-size: 0.78rem; }
.exif-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.exif-grid label { display: flex; flex-direction: column; gap: 6px; }
.exif-grid label span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.exif-grid input {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  border-radius: 0;
}
#map {
  height: 240px;
  margin-top: 12px;
  border: 1px solid var(--line);
  filter: grayscale(0.7) contrast(0.95);
}
.map-hint { margin: 8px 0 0; color: var(--muted); font-size: 0.78rem; }
@media (max-width: 800px) {
  .exif-grid { grid-template-columns: 1fr; }
}
.row span {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
select, .row input:not([type=checkbox]) {
  appearance: none;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  border-radius: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 22px;
}
button {
  height: 42px;
  padding: 0 22px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: wait; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.note { margin: 0; color: var(--muted); font-size: 0.86rem; }

.log {
  margin-top: 28px;
  padding: 16px 18px;
  background: #1b1814;
  color: #e8e0d4;
  font: 12px/1.55 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
}

.result { margin-top: 40px; }
.caption {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.15rem;
}
.frames {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
figure { margin: 0; }
figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #cfc7bb;
}
figcaption, .meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}
.meta { margin-top: 14px; }

@media (max-width: 800px) {
  main { padding-top: 32px; }
  .row { grid-template-columns: 1fr 1fr; }
  .frames { grid-template-columns: 1fr; }
}
