:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #5e574e;
  --line: #e4d9c8;
  --paper: #f3eee4;
  --card: #fffdf9;
  --cobalt: #2346c4;
  --cobalt-dark: #1a3496;
  --stamp: #a68445;
  --warn: #9f2d2d;
  --ok: #1f6b45;
}

* { box-sizing: border-box; }

html { overflow-x: clip; }

body {
  margin: 0;
  background:
    radial-gradient(880px 420px at 100% -8%, rgba(35, 70, 196, 0.14), transparent 56%),
    radial-gradient(720px 380px at -12% 0%, rgba(196, 164, 106, 0.32), transparent 52%),
    var(--paper);
  color: var(--ink);
  font: 1.05rem/1.6 "Segoe UI", system-ui, sans-serif;
}

a { color: var(--cobalt); }

code { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.92em; }

.wrap {
  width: min(40rem, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.1rem 0 4rem;
}

.wrap.home { width: min(48rem, calc(100% - 1.5rem)); }

.topbar { margin-bottom: 1.15rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.28rem 0.85rem 0.28rem 0.28rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 8px 20px rgba(28, 25, 21, 0.06);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 700;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  color: var(--cobalt-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0 0 0.75rem;
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  font-size: clamp(2.15rem, 5vw, 3.15rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h1::after {
  content: "";
  display: block;
  width: 2.6rem;
  height: 0.28rem;
  margin-top: 0.75rem;
  border-radius: 99px;
  background: var(--cobalt);
}

h2 {
  margin: 1.8rem 0 0.55rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

h3 { margin: 1.1rem 0 0.3rem; font-size: 1.05rem; }

.lead { margin: 0 0 1rem; font-size: 1.12rem; }

.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.modes button,
.picks button,
.go,
.ghost {
  font: inherit;
  cursor: pointer;
}

.modes button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.62rem 0.35rem;
  font-weight: 700;
}

.modes button[aria-selected="true"] {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

.modes button:disabled,
.picks button:disabled,
.go:disabled,
.ghost:disabled,
.files button:disabled {
  cursor: default;
  opacity: 0.55;
}

.tool {
  padding: 1.05rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.4), transparent 2.2rem),
    var(--card);
  box-shadow: 0 18px 40px rgba(48, 36, 16, 0.08);
}

.stamp {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.08rem 0.45rem 0.12rem;
  border: 2px solid var(--stamp);
  border-radius: 0.35rem;
  color: #7a5d2a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-1.5deg);
}

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 9.5rem;
  margin-bottom: 0.85rem;
  padding: 1.1rem 1rem;
  border: 2px dashed #b9c3e6;
  border-radius: 18px;
  background: #f7f8fd;
  text-align: center;
  cursor: pointer;
}

.drop.is-drag,
.drop:hover,
.drop:focus-within {
  border-color: var(--cobalt);
  background: #eef2ff;
  box-shadow: 0 0 0 4px rgba(35, 70, 196, 0.16);
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title {
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1.15;
}

.drop-hint {
  margin-top: 0.3rem;
  color: var(--muted);
}

.note,
.hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.note {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #f8f1e2;
  color: #4d4334;
}

.field {
  display: block;
  margin: 0.2rem 0 0.3rem;
  font-weight: 700;
}

.range {
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.picks button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-weight: 700;
}

.picks button[aria-pressed="true"] {
  background: #1c1915;
  border-color: #1c1915;
  color: #fff;
}

.files {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
}

.files li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
  margin-bottom: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: #f6f3ec;
}

.fname {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.fmeta { color: var(--muted); }

.files button {
  border: 0;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.status {
  min-height: 1.6em;
  margin: 0.2rem 0 0.25rem;
  font-weight: 600;
}

.status.is-bad { color: var(--warn); }
.status.is-work { color: var(--cobalt-dark); }
.status.is-ok { color: var(--ok); }

.detail {
  margin: 0 0 0.75rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.go {
  flex: 1 1 14rem;
  border: 0;
  border-radius: 14px;
  padding: 0.8rem 1rem;
  background: var(--cobalt);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
}

.go:hover:not(:disabled) { background: var(--cobalt-dark); }

.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 0.6rem 0.4rem;
}

.jobs { margin: 0.4rem 0 0; }

.jobs div {
  margin: 0 0 0.85rem;
  padding-top: 0.7rem;
  border-top: 3px solid var(--cobalt);
}

.jobs div:nth-child(2) { border-top-color: var(--stamp); }
.jobs div:nth-child(3) { border-top-color: #1f6b45; }
.jobs div:nth-child(4) { border-top-color: #1c1915; }
.jobs div:nth-child(5) { border-top-color: var(--cobalt); }
.jobs div:nth-child(6) { border-top-color: var(--stamp); }
.jobs div:nth-child(7) { border-top-color: #1f6b45; }
.jobs div:nth-child(8) { border-top-color: #1c1915; }

.jobs dt { font-weight: 800; }
.jobs dd { margin: 0.2rem 0 0; }

ol.steps { margin: 0.3rem 0 0; padding-left: 1.2rem; }
ol.steps li { margin: 0.3rem 0; }

ul.plain { margin: 0.3rem 0 0; padding-left: 1.15rem; }
ul.plain li { margin: 0.3rem 0; }

footer {
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

footer nav a {
  display: inline-block;
  padding: 0.18rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
}

footer nav a[aria-current="page"] {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: #fff;
}

footer p { margin: 0; }

.preview {
  margin: 0 0 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(35, 70, 196, 0.06), transparent 4.2rem),
    #f6f1e7;
}

.preview-kicker {
  margin: 0 0 0.15rem;
  color: var(--cobalt-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.preview-note {
  margin: 0 0 0.65rem;
  color: #4d4334;
  font-weight: 600;
}

.preview.is-empty .preview-note { margin-bottom: 0; }

.preview.is-empty .preview-stage,
.preview.is-empty .preview-thumbs,
.preview-stage[hidden],
.preview-thumbs[hidden] {
  display: none !important;
}

.preview-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "frame frame"
    "prev next";
  gap: 0.55rem 0.6rem;
  align-items: center;
}

.preview-nav {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.preview-nav:disabled {
  cursor: default;
  opacity: 0.4;
}

.preview-frame { grid-area: frame; margin: 0; min-width: 0; }
#preview-prev { grid-area: prev; justify-self: start; }
#preview-next { grid-area: next; justify-self: end; }

.preview-sheet {
  position: relative;
  display: block;
  padding: 2.35rem 0.35rem 0.45rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e7dfd2, 0 10px 24px rgba(48, 36, 16, 0.08);
}

.preview-sheet canvas[hidden],
.preview-sheet img[hidden] {
  display: none !important;
}

.preview-sheet canvas,
.preview-sheet img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  background: #fff;
  box-shadow: 0 1px 0 rgba(28, 25, 21, 0.08);
}

.preview-sheet.is-dim canvas,
.preview-sheet.is-dim img { opacity: 0.38; }

.preview-badge {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  max-width: calc(100% - 1.1rem);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--cobalt);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.preview-sheet.is-stay .preview-badge { background: var(--ok); }
.preview-sheet.is-drop .preview-badge { background: var(--warn); }

.preview-frame figcaption {
  margin: 0.45rem 0 0;
  color: var(--muted);
  text-align: center;
}

.preview-thumbs {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
}

.thumb {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.thumb:disabled { cursor: default; }

.thumb-sheet {
  position: relative;
  display: grid;
  place-items: center;
  width: 4.7rem;
  height: 6rem;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 10px rgba(48, 36, 16, 0.06);
}

.thumb[aria-current="true"] .thumb-sheet {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(35, 70, 196, 0.18);
}

.thumb-sheet canvas,
.thumb-sheet img {
  display: block;
  max-width: 3.5rem;
  max-height: 4.5rem;
  background: #fff;
}

.thumb-sheet.is-turn-90 canvas,
.thumb-sheet.is-turn-90 img,
.thumb-sheet.is-turn-270 canvas,
.thumb-sheet.is-turn-270 img {
  max-width: 3.1rem;
  max-height: 3.1rem;
  transform: rotate(90deg) scale(0.78);
}

.thumb-sheet.is-turn-180 canvas,
.thumb-sheet.is-turn-180 img { transform: rotate(180deg); }

.thumb-sheet.is-turn-270 canvas,
.thumb-sheet.is-turn-270 img { transform: rotate(270deg) scale(0.78); }

.thumb-sheet.is-dim canvas,
.thumb-sheet.is-dim img { opacity: 0.38; }

.thumb-badge {
  position: absolute;
  right: 0.15rem;
  bottom: 0.15rem;
  left: 0.15rem;
  padding: 0.05rem 0.15rem;
  border-radius: 4px;
  background: var(--cobalt);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.thumb-sheet.is-stay .thumb-badge { background: var(--ok); }
.thumb-sheet.is-drop .thumb-badge { background: var(--warn); }

.thumb-label {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

@media (max-width: 700px) {
  .modes { grid-template-columns: 1fr 1fr; }
  .drop { min-height: 8.2rem; }
}
