/* ImgCap — image compressor                                                          */
/* A single-screen tool: header, one settings strip, the queue, a status bar.        */

/* ------------------------------------------------------------------ */
/* fonts                                                              */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: 'Inter';
  src: url('./fonts/inter.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  font-style: normal;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('./fonts/mono.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
  font-style: normal;
}

/* ------------------------------------------------------------------ */
/* tokens                                                             */
/* ------------------------------------------------------------------ */

:root {
  --canvas: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #fafbf7;
  --surface-3: #f1f4ec;
  --line: #e6eade;
  --line-2: #d2d9c8;
  --ink: #111513;
  --ink-2: #3a423e;
  --muted: #79817a;
  --lime: #c8f45a;
  --lime-2: #b6e544;
  --lime-soft: #f0fbd3;
  --lime-ink: #40570a;
  --green: #2f7a45;
  --orange: #c2620b;
  --amber: #8a5c00;
  --danger: #b03a2b;
  --danger-soft: #fdeeea;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-1: 0 1px 2px rgb(17 21 19 / 5%);
  --shadow-2: 0 1px 2px rgb(17 21 19 / 5%), 0 10px 30px -18px rgb(17 21 19 / 25%);
  --shadow-3: 0 24px 70px -30px rgb(17 21 19 / 45%), 0 2px 8px rgb(17 21 19 / 6%);

  --bar-h: 54px;
  --shell: 1280px;
  color-scheme: light;
}

/* ------------------------------------------------------------------ */
/* base                                                               */
/* ------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  /* The shell is viewport sized, so a downward drag on the page is always an
     overscroll — let it end there instead of reaching the browser's pull to
     refresh and reloading a queue the user has not saved yet. */
  overscroll-behavior-y: none;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  /* keeps a double tap from zooming the app on touch screens */
  touch-action: manipulation;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  /* The smallest viewport, so a browser that keeps its toolbars on screen
     never paints them over the status bar or the footer. */
  height: 100dvh;
  height: 100svh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 13px;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 4px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  font: 500 11px/1.5 var(--mono);
  text-align: center;
  color: var(--ink-2);
}

.sep {
  padding: 0 6px;
  color: var(--line-2);
}

/* ------------------------------------------------------------------ */
/* buttons                                                            */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    transform 0.14s ease;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn--ink {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.btn--ink:hover {
  background: #232925;
  border-color: #232925;
}

.btn--ink:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
  opacity: 1;
}

.btn--lime {
  border-color: var(--lime-2);
  background: var(--lime);
  color: var(--lime-ink);
}

.btn--lime:hover {
  background: var(--lime-2);
}

.btn--lime:disabled {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--muted);
  opacity: 1;
}

.btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn--quiet:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.iconbtn svg {
  width: 17px;
  height: 17px;
}

.iconbtn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.iconbtn--sm {
  width: 26px;
  height: 26px;
}

.iconbtn--sm svg {
  width: 15px;
  height: 15px;
}

.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 2px;
  cursor: pointer;
}

.linkbtn:hover {
  text-decoration-color: currentColor;
}

/* ------------------------------------------------------------------ */
/* header                                                             */
/* ------------------------------------------------------------------ */

.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--surface);
}

.bar[data-stuck] {
  box-shadow: 0 1px 0 var(--line), var(--shadow-2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--lime);
}

.brand__mark svg {
  width: 16px;
  height: 16px;
}

.brand__word {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.bar__rule {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.bar__note {
  font: 400 12px/1 var(--mono);
  color: var(--muted);
  letter-spacing: 0.01em;
}

.bar__end {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.bar__credit {
  margin-right: 4px;
  font: 400 11px/1 var(--mono);
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* settings strip                                                     */
/* ------------------------------------------------------------------ */

.settings {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(var(--shell), 100% - 32px);
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.setting {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting__label {
  font: 500 11px/1 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}

.target {
  display: flex;
  align-items: stretch;
  height: 30px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.14s ease;
}

.target:focus-within {
  border-color: var(--ink);
}

.target__input {
  width: 64px;
  padding: 0 8px;
  border: 0;
  background: none;
  font: 500 13px/1 var(--mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.target__input:focus {
  outline: none;
}

.target__unit {
  height: 100%;
  padding: 0 4px 0 6px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-2);
  font: 500 11px/1 var(--mono);
  color: var(--ink-2);
  cursor: pointer;
  appearance: none;
  padding-right: 16px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    right 9px center,
    right 6px center;
  background-size: 3px 3px, 3px 3px;
  background-repeat: no-repeat;
}

.target__unit:focus {
  outline: none;
}

.chips {
  display: flex;
  gap: 4px;
}

.select.presets__select {
  display: none;
}

.chip {
  height: 26px;
  min-width: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--ink-2);
  font: 500 11px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}

.chip:hover {
  background: #e8eddf;
}

.chip[aria-pressed='true'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--lime);
}

.select {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color 0.14s ease;
}

.select:focus-within {
  border-color: var(--ink);
}

.select select {
  height: 100%;
  padding: 0 26px 0 9px;
  border: 0;
  background: none;
  font: 500 12.5px/1 var(--sans);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
}

.select select:focus {
  outline: none;
}

.select__chevron {
  position: absolute;
  right: 6px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.settings__end {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.iconbtn--reset {
  margin-left: -6px;
}

.iconbtn--reset:hover {
  color: var(--ink);
}

/* ------------------------------------------------------------------ */
/* app shell                                                          */
/* ------------------------------------------------------------------ */

.app {
  display: flex;
  align-items: stretch;
  min-height: 0;
  width: min(var(--shell), 100% - 32px);
  margin-inline: auto;
  padding: 12px 0 16px;
}

.foot {
  width: min(var(--shell), 100% - 32px);
  margin-inline: auto;
  padding: 0 0 10px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* dropzone                                                           */
/* ------------------------------------------------------------------ */

.drop {
  position: relative;
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 200px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease;
}

.drop:hover {
  background: #fdfefb;
}

.drop:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--lime-2);
}

.drop__inner {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 24px;
  text-align: center;
}

.drop__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  background: var(--lime-soft);
  color: var(--lime-ink);
}

.drop__icon svg {
  width: 21px;
  height: 21px;
}

.drop__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.drop__sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.drop__formats {
  margin: 14px 0 0;
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.drop__formats span {
  color: var(--line-2);
}

.drop__formats span + * {
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* queue                                                              */
/* ------------------------------------------------------------------ */

.queue {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.queue[data-empty='true'] {
  border-style: dashed;
  border-color: var(--line-2);
  box-shadow: none;
}

.list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.list::-webkit-scrollbar {
  width: 10px;
}

.list::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid var(--surface);
  border-radius: 8px;
}

.item {
  content-visibility: auto;
  contain-intrinsic-size: auto 58px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 58px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}

.item:last-child {
  border-bottom: 0;
}

.item:hover {
  background: var(--surface-2);
}

.item__hit {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 76px 224px;
  align-items: center;
  gap: 12px;
  flex: 1;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.item__hit:disabled {
  cursor: default;
}

.item__thumb {
  display: block;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  overflow: hidden;
}

.item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.item__body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.item__name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__meta {
  overflow: hidden;
  font: 400 11px/1.4 var(--mono);
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item__meta span + span::before {
  content: ' · ';
  color: var(--line-2);
}

.item__status {
  justify-self: end;
  padding: 3px 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.item__status[data-state='working'] {
  color: var(--orange);
}

.item__status[data-state='done'] {
  color: var(--green);
}

.item__status[data-state='stale'] {
  color: var(--amber);
}

.item__status[data-state='error'] {
  color: var(--danger);
}

.item__numbers {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font: 400 12px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}

.item__from {
  min-width: 58px;
  text-align: right;
  color: var(--muted);
}

.item__arrow {
  color: var(--line-2);
}

.item__to {
  min-width: 58px;
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}

.item__delta {
  min-width: 58px;
  padding: 3px 0;
  border-radius: 5px;
  background: var(--lime-soft);
  color: var(--lime-ink);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

.item__delta:empty {
  background: none;
}

.item__delta.is-warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.item[data-state='queued'] .item__delta,
.item[data-state='working'] .item__delta {
  background: none;
  color: var(--muted);
}

.item[data-state='error'] {
  background: #fffbfa;
}

.item[data-state='error'] .item__meta {
  color: var(--danger);
}

.item[data-state='error'] .item__thumb img {
  display: none;
}

.item[data-state='error'] .item__thumb {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9c2b2' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='3'/%3E%3Cpath d='M3.5 17l4.6-4.6a1.5 1.5 0 0 1 2.1 0l3.1 3.1'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

.item[data-state='stale'] .item__delta {
  background: var(--surface-3);
  color: var(--muted);
}

.item[data-state='stale'] .item__to {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-2);
}

.item__actions {
  display: flex;
  justify-content: flex-end;
  width: 80px;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.item:hover .item__actions,
.item:focus-within .item__actions {
  opacity: 1;
}

.item__bar {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
}

.item[data-state='working'] .item__bar {
  opacity: 1;
}

.item__bar span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  animation: slide 1.1s linear infinite;
}

@keyframes slide {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(320%);
  }
}

/* ------------------------------------------------------------------ */
/* status bar                                                         */
/* ------------------------------------------------------------------ */

.status {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 50px;
  padding: 8px 10px 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.status__summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  font-size: 12px;
}

.status__count {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.status__totals {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font: 400 11.5px/1 var(--mono);
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status__totals .arrow {
  color: var(--line-2);
}

.status__totals .saved {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--lime-soft);
  color: var(--lime-ink);
  font-weight: 500;
}

.status__totals .larger {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 500;
}

.status__totals .failed {
  color: var(--danger);
}

.status__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

/* ------------------------------------------------------------------ */
/* compare dialog                                                     */
/* ------------------------------------------------------------------ */

.modal {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100svh - 40px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.modal::backdrop {
  background: rgb(17 21 19 / 38%);
  backdrop-filter: blur(3px);
}

.modal[open] {
  display: flex;
  flex-direction: column;
  animation: pop 0.16s ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }
}

.modal__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--line);
}

.modal__title {
  min-width: 0;
}

.modal__title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal__sub {
  margin: 2px 0 0;
  font: 400 11px/1.4 var(--mono);
  color: var(--muted);
}

.modal__head .iconbtn {
  margin-left: auto;
}

.cmp {
  --pos: 50%;
  position: relative;
  flex: 0 1 auto;
  height: clamp(220px, 52svh, 460px);
  background: repeating-conic-gradient(#f2f5ec 0% 25%, #fdfefb 0% 50%) 50% / 14px 14px;
  overflow: hidden;
  touch-action: none;
}

.cmp__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.cmp__img--out {
  clip-path: inset(0 0 0 var(--pos));
}

.cmp__tag {
  position: absolute;
  top: 10px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow-1);
  font: 500 10px/1.6 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  pointer-events: none;
}

.cmp__tag--a {
  left: 10px;
}

.cmp__tag--b {
  right: 10px;
}

.cmp__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  z-index: 2;
  width: 2px;
  margin-left: -1px;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgb(17 21 19 / 12%);
  pointer-events: none;
}

.cmp__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow:
    0 1px 3px rgb(17 21 19 / 22%),
    0 0 0 1px rgb(17 21 19 / 6%);
  transform: translate(-50%, -50%);
}

.cmp__handle::before,
.cmp__handle::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-block: 4px solid transparent;
}

.cmp__handle::before {
  left: 8px;
  border-right: 5px solid var(--ink-2);
}

.cmp__handle::after {
  right: 8px;
  border-left: 5px solid var(--ink-2);
}

.cmp__range {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  appearance: none;
  background: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.stat {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  background: var(--surface);
}

.stat dt {
  font: 500 10px/1 var(--sans);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat dd {
  margin: 0;
  font: 500 13px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat dd.good {
  color: var(--lime-ink);
}

.stat dd.warn {
  color: var(--danger);
}

.modal__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

/* ------------------------------------------------------------------ */
/* toasts                                                             */
/* ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 60;
  display: grid;
  gap: 8px;
  justify-items: center;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: 12.5px;
  color: var(--ink);
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ------------------------------------------------------------------ */
/* drag overlay                                                       */
/* ------------------------------------------------------------------ */

.dragveil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  background: rgb(244 246 242 / 45%);
}

body.is-dragging .dragveil {
  display: grid;
}

.dragveil__box {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 52px 76px;
  border: 2px dashed var(--lime-2);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.dragveil__box svg {
  width: 26px;
  height: 26px;
  color: var(--lime-ink);
}

.dragveil__box p {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.dragveil__box span {
  font: 400 11px/1 var(--mono);
  color: var(--muted);
}

.noscript {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 1060px) {
  .settings {
    flex-wrap: wrap;
    gap: 10px 18px;
  }

  .settings__end {
    margin-left: auto;
  }
}

@media (max-width: 780px) {
  .app {
    padding: 10px 0;
  }

  .foot {
    padding: 0 0 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .settings,
  .app,
  .foot {
    width: min(var(--shell), 100% - 20px);
  }

  .bar {
    padding: 0 10px;
    gap: 8px;
  }

  .bar__note,
  .bar__credit,
  .bar__rule {
    display: none;
  }

  .settings {
    margin: 10px 10px 0;
    gap: 10px 18px;
    padding: 10px;
  }

  .iconbtn--reset {
    display: none;
  }

  .setting {
    flex: 1 1 0;
    min-width: 0;
  }

  .chips {
    display: none;
  }

  .select.presets__select {
    display: flex;
  }

  .target {
    min-width: 0;
  }

  .target__input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .settings__end {
    order: 4;
  }

  .status {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px;
  }

  .status__totals .arrow,
  .status__totals .total-out {
    display: none;
  }

  .status__actions {
    width: 100%;
    margin-left: 0;
  }

  .status__actions .btn {
    flex: 1;
    justify-content: center;
  }

  .status__actions .btn--quiet {
    flex: 0 0 auto;
  }

  .item {
    contain-intrinsic-size: auto 56px;
    height: 56px;
    padding-left: 8px;
  }

  .item__hit {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .item__status {
    display: none;
  }

  .item__thumb {
    width: 36px;
    height: 36px;
  }

  .item__from {
    display: none;
  }

  .item__arrow {
    display: none;
  }

  .item__delta {
    min-width: 50px;
  }

  .item__actions {
    opacity: 1;
  }


  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100svh - 16px);
  }

  .modal__head,
  .modal__foot {
    padding-left: 14px;
  }

  .modal__foot .btn--ink {
    flex: 1;
    justify-content: center;
  }

  .cmp {
    min-height: 200px;
    max-height: 46svh;
  }
}

@media (max-width: 560px) {
  .settings {
    align-items: flex-end;
  }

  .setting {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .setting__label {
    font-size: 10px;
  }

  .settings__end {
    width: 100%;
  }

  .settings__end .btn {
    flex: 1;
    justify-content: center;
  }

  .item__meta .meta-from {
    display: none;
  }

  .item__numbers {
    gap: 6px;
  }

  .item__to {
    min-width: 50px;
  }

  .item__delta {
    min-width: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .item__bar span {
    width: 100%;
    background: var(--lime-2);
  }
}


/* ------------------------------------------------------------------ */
/* view transitions                                                   */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation-duration: 240ms;
    animation-timing-function: cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  /* Rows are named, so they morph on their own; cross fading the whole
     page on top of that only shows through as ghosting. */
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}
