@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/unbounded-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --paper: #f2f3ef;
  --paper-bright: #fbfcf8;
  --paper-muted: #e4e8e6;
  --ink: #0d1720;
  --ink-muted: #526069;
  --line: #aeb8bb;
  --line-strong: #14212b;
  --cobalt: #064ed8;
  --cobalt-dark: #103a94;
  --cobalt-soft: #dfe9ff;
  --vermilion: #e4422f;
  --vermilion-soft: #ffe5df;
  --amber: #d98a08;
  --green: #13765a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --font-brand: "Unbounded", Arial, sans-serif;
  --font-ui: Inter, "Segoe UI", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: var(--font-ui);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html,
body {
  background: var(--paper);
  color: var(--ink);
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

[hidden] {
  display: none !important;
}

.sr-only {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link {
  background: var(--ink);
  color: white;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  position: fixed;
  top: -5rem;
  z-index: 100;
}

.skip-link:focus {
  top: calc(var(--safe-top) + 0.75rem);
}

.focus-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  height: 100dvh;
  min-height: 100%;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.focus-header {
  align-items: center;
  border-bottom: 1px solid var(--line-strong);
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: calc(3.75rem + var(--safe-top));
  padding: calc(0.55rem + var(--safe-top)) 0.75rem 0.55rem;
}

.focus-brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  gap: 0.48rem;
  min-height: 2.75rem;
  text-decoration: none;
}

.focus-brand span {
  font-family: var(--font-brand);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.focus-run-copy {
  min-width: 0;
}

.focus-run-primary {
  align-items: center;
  display: flex;
  gap: 0.45rem;
  min-width: 0;
}

.focus-run-copy strong,
.focus-run-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-run-copy strong {
  font-size: 0.82rem;
  flex: 0 0 auto;
}

.focus-run-copy select {
  background: var(--paper-bright);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  min-height: 2.75rem;
  min-width: 0;
  padding: 0 0.55rem;
  text-overflow: ellipsis;
  width: min(12rem, 100%);
}

.focus-run-copy select:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}

.focus-run-copy select:disabled {
  background: var(--paper-muted);
  border-color: var(--line);
  color: var(--ink-muted);
  cursor: not-allowed;
}

.focus-run-copy span {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  margin-top: 0.18rem;
}

.focus-header-actions {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.icon-button,
.exit-link {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 750;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 0.72rem;
  text-decoration: none;
}

.icon-button {
  font-size: 1.1rem;
}

.focus-progress {
  border-bottom: 1px solid var(--line);
  grid-row: 2;
  padding: 0.42rem 0.75rem 0.48rem;
}

.focus-progress-copy {
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  gap: 0.8rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-track {
  background: #c7cecf;
  height: 0.22rem;
  overflow: hidden;
}

.progress-track span {
  background: var(--cobalt);
  display: block;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 180ms ease;
}

.network-banner {
  align-items: center;
  background: var(--vermilion-soft);
  border-bottom: 1px solid var(--vermilion);
  display: flex;
  font-size: 0.72rem;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.42rem 0.75rem;
  grid-row: 3;
}

.focus-stage {
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(13, 23, 32, 0.08) 50%, transparent calc(50% + 0.5px)),
    var(--paper-muted);
  min-height: 0;
  overflow: hidden;
  padding: clamp(0.45rem, 2vw, 1rem);
  position: relative;
  grid-row: 4;
}

.focus-card {
  background: var(--paper-bright);
  border: 1px solid var(--line-strong);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  margin: 0 auto;
  max-width: 42rem;
  min-height: 0;
  position: relative;
  touch-action: pinch-zoom;
  transform-origin: 50% 88%;
  will-change: transform;
}

.focus-card:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 2px;
}

.focus-card.dragging {
  cursor: grabbing;
  transition: none;
  user-select: none;
}

.focus-card.settling {
  transition: transform 220ms cubic-bezier(0.22, 0.8, 0.32, 1), opacity 180ms ease;
}

.image-frame {
  align-items: center;
  background: #d7dcda;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.image-frame img {
  display: block;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  opacity: 1;
  user-select: none;
  width: 100%;
}

.image-frame img.loading {
  opacity: 0;
}

.image-loader {
  animation: loader 1s linear infinite;
  border: 2px solid rgba(13, 23, 32, 0.2);
  border-top-color: var(--cobalt);
  height: 2.1rem;
  left: calc(50% - 1.05rem);
  position: absolute;
  top: calc(50% - 1.05rem);
  width: 2.1rem;
}

.candidate-caption {
  border-top: 1px solid var(--line-strong);
  min-height: 5.4rem;
  padding: 0.62rem 0.78rem 0.68rem;
}

.caption-kicker {
  color: var(--cobalt);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 0.23rem;
  text-transform: uppercase;
}

.candidate-caption h1 {
  display: -webkit-box;
  font-family: var(--font-brand);
  font-size: clamp(0.88rem, 3.2vw, 1.15rem);
  font-weight: 760;
  line-height: 1.28;
  margin: 0;
  max-height: 2.58em;
  overflow: hidden;
  overflow-wrap: anywhere;
  padding-bottom: 0.08em;
  text-wrap: balance;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.candidate-caption > p:last-child {
  color: var(--ink-muted);
  font-size: 0.72rem;
  margin: 0.3rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swipe-signal {
  background: var(--paper-bright);
  border: 3px solid currentColor;
  font-family: var(--font-brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  opacity: 0;
  padding: 0.48rem 0.62rem;
  pointer-events: none;
  position: absolute;
  top: 1rem;
  z-index: 5;
}

.swipe-accept {
  color: var(--green);
  left: 1rem;
  transform: rotate(-4deg);
}

.swipe-reject {
  color: var(--vermilion);
  right: 1rem;
  transform: rotate(4deg);
}

.swipe-later {
  bottom: 6.3rem;
  color: var(--amber);
  left: 50%;
  top: auto;
  transform: translateX(-50%);
}

.focus-controls {
  background: var(--paper-bright);
  border-top: 1px solid var(--line-strong);
  grid-row: 5;
  padding: 0.55rem max(0.65rem, var(--safe-right)) calc(0.52rem + var(--safe-bottom)) max(0.65rem, var(--safe-left));
}

.primary-actions {
  display: grid;
  gap: 0.42rem;
  grid-template-columns: 1fr 0.8fr 1fr;
}

.action-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  display: grid;
  gap: 0.1rem 0.4rem;
  grid-template-columns: auto 1fr;
  min-height: 3.2rem;
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.action-button kbd {
  align-items: center;
  border-right: 1px solid var(--line);
  display: flex;
  font-family: var(--font-mono);
  grid-row: 1 / 3;
  height: 100%;
  padding-right: 0.42rem;
}

.action-button span {
  font-size: 0.76rem;
  font-weight: 800;
}

.action-button small {
  color: var(--ink-muted);
  font-size: 0.59rem;
}

.reject-action:hover,
.reject-action:active {
  background: var(--vermilion-soft);
  border-color: var(--vermilion);
}

.later-action:hover,
.later-action:active {
  background: #fff0ce;
  border-color: var(--amber);
}

.accept-action {
  background: var(--cobalt);
  border-color: var(--cobalt);
  color: white;
}

.accept-action small {
  color: rgba(255, 255, 255, 0.76);
}

.secondary-actions {
  display: grid;
  gap: 0.3rem;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 0.35rem;
}

.secondary-actions button {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  font-size: 0.64rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.15rem;
}

.secondary-actions button[aria-pressed="true"] {
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-weight: 800;
}

.secondary-actions button:hover,
.secondary-actions button:focus-visible,
.icon-button:hover,
.exit-link:hover {
  background: var(--cobalt-soft);
  color: var(--cobalt);
}

.secondary-actions button:disabled,
.primary-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.mobile-action-label,
.swipe-guide {
  display: none;
}

kbd {
  background: transparent;
  font-family: var(--font-mono);
}

.gesture-hint {
  color: var(--ink-muted);
  font-size: 0.58rem;
  margin: 0.15rem 0 0;
  text-align: center;
}

.empty-state {
  left: 50%;
  max-width: 22rem;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 2rem);
}

.empty-state h1 {
  font-family: var(--font-brand);
  font-size: 1.35rem;
}

.empty-state p {
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.empty-state a {
  background: var(--ink);
  color: white;
  display: inline-flex;
  font-weight: 750;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
}

dialog {
  border: 0;
  margin: auto;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  padding: 0;
}

dialog::backdrop {
  background: rgba(7, 15, 21, 0.62);
  backdrop-filter: blur(3px);
}

.decision-sheet,
.details-sheet {
  background: transparent;
  max-width: 34rem;
  width: min(calc(100% - 1rem), 34rem);
}

.decision-sheet-frame,
.details-sheet-frame {
  background: var(--paper-bright);
  border: 2px solid var(--line-strong);
  margin: 0;
  max-height: calc(100dvh - 1rem - var(--safe-top) - var(--safe-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: var(--safe-bottom);
}

.decision-sheet[data-tone="reject"] .decision-sheet-frame {
  border-color: var(--vermilion);
}

.decision-sheet[data-tone="accept"] .decision-sheet-frame {
  border-color: var(--cobalt);
}

.decision-sheet header,
.details-sheet header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.9rem 1rem;
}

.decision-sheet header p,
.details-sheet header p {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  margin: 0.28rem 0 0;
}

.decision-sheet header h2,
.details-sheet header h2 {
  font-family: var(--font-brand);
  font-size: 1rem;
  line-height: 1.3;
  margin: 0.15rem 0 0;
  text-wrap: balance;
}

.sheet-close {
  background: transparent;
  border: 1px solid var(--line-strong);
  font-size: 1.3rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
}

.decision-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.decision-option {
  align-items: stretch;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  min-height: 4.6rem;
  padding: 0;
  text-align: left;
}

.decision-option:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.decision-option kbd {
  align-items: center;
  border-right: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.decision-option span {
  align-self: center;
  display: block;
  padding: 0.6rem;
}

.decision-option strong,
.decision-option small {
  display: block;
}

.decision-option strong {
  font-size: 0.78rem;
  line-height: 1.2;
}

.decision-option small {
  color: var(--ink-muted);
  font-size: 0.65rem;
  line-height: 1.35;
  margin-top: 0.2rem;
}

.decision-sheet[data-tone="reject"] .decision-option:hover,
.decision-sheet[data-tone="reject"] .decision-option:focus-visible {
  background: var(--vermilion-soft);
}

.decision-sheet[data-tone="accept"] .decision-option:hover,
.decision-sheet[data-tone="accept"] .decision-option:focus-visible {
  background: var(--cobalt-soft);
}

.details-sheet-frame {
  padding-bottom: calc(1rem + var(--safe-bottom));
}

.details-sheet dl {
  display: grid;
  font-size: 0.75rem;
  gap: 0;
  grid-template-columns: 7rem 1fr;
  margin: 0;
  padding: 0.75rem 1rem;
}

.details-sheet dt,
.details-sheet dd {
  border-bottom: 1px dotted var(--line);
  margin: 0;
  overflow-wrap: anywhere;
  padding: 0.55rem 0;
}

.details-sheet dt {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.details-sheet > form > a {
  color: var(--cobalt);
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 750;
  margin: 0.25rem 1rem 0;
  min-height: 2.75rem;
  padding: 0.7rem 0;
}

.toast-region {
  bottom: calc(10.7rem + var(--safe-bottom));
  left: 50%;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  width: min(90%, 24rem);
  z-index: 90;
}

.toast {
  align-items: center;
  background: var(--ink);
  border: 1px solid white;
  color: white;
  display: flex;
  font-size: 0.72rem;
  font-weight: 700;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
}

.toast.error {
  background: #781b16;
}

.toast button {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  margin-left: 0.75rem;
  min-height: 2.3rem;
  padding: 0.35rem 0.55rem;
}

@keyframes loader {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .focus-brand span {
    display: none;
  }

  .focus-header {
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  }

  .focus-run-copy select {
    width: min(9rem, 100%);
  }

  .focus-run-copy strong {
    display: none;
  }

  .exit-link {
    font-size: 0;
    padding: 0;
  }

  .exit-link::before {
    content: "×";
    font-size: 1.35rem;
  }
}

@media (max-width: 340px) {
  .focus-progress-copy {
    gap: 0.34rem;
    font-size: 0.56rem;
  }

  .action-button {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 0.3rem 0.25rem;
    text-align: center;
  }

  .action-button kbd,
  .action-button small {
    display: none;
  }

  .secondary-actions button {
    font-size: 0.58rem;
  }
}

@media (min-width: 800px) {
  .focus-shell {
    grid-template-columns: minmax(0, 1fr) 22rem;
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .focus-header,
  .focus-progress,
  .network-banner {
    grid-column: 1 / -1;
  }

  .focus-stage {
    grid-column: 1;
    grid-row: 4;
    padding: 1rem;
  }

  .focus-controls {
    border-left: 1px solid var(--line-strong);
    border-top: 0;
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 4;
    justify-content: center;
    padding: 1rem;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .secondary-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .focus-card {
    max-width: min(48rem, 72vw);
  }

  .toast-region {
    bottom: 1rem;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .focus-header {
    min-height: calc(3rem + var(--safe-top));
    padding-bottom: 0.25rem;
    padding-top: calc(0.25rem + var(--safe-top));
  }

  .focus-progress {
    padding-bottom: 0.3rem;
    padding-top: 0.3rem;
  }

  .focus-shell {
    grid-template-columns: minmax(0, 1fr) 18rem;
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .focus-header,
  .focus-progress,
  .network-banner {
    grid-column: 1 / -1;
  }

  .focus-stage {
    grid-column: 1;
    grid-row: 4;
  }

  .focus-controls {
    border-left: 1px solid var(--line-strong);
    border-top: 0;
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 4;
    justify-content: center;
    padding: 0.55rem;
  }

  .primary-actions {
    grid-template-columns: 1fr;
  }

  .secondary-actions {
    grid-template-columns: repeat(2, 1fr);
  }

  .candidate-caption {
    min-height: 4.3rem;
  }

  .candidate-caption > p:last-child,
  .gesture-hint {
    display: none;
  }
}

@media (max-width: 799px), (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .focus-controls {
    padding-top: 0.52rem;
  }

  .primary-actions,
  .desktop-action-label,
  #favoriteButton,
  .gesture-hint {
    display: none;
  }

  .primary-actions {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    display: grid;
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .primary-actions:focus-within {
    clip: auto;
    clip-path: none;
    grid-template-columns: repeat(3, 1fr);
    height: auto;
    margin-bottom: 0.42rem;
    overflow: visible;
    position: static;
    white-space: normal;
    width: auto;
  }

  .mobile-action-label {
    display: inline;
  }

  .secondary-actions {
    display: grid;
    gap: 0.42rem;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.25fr);
    margin-top: 0;
  }

  .secondary-actions button {
    font-size: 0.72rem;
    font-weight: 800;
    min-height: 2.9rem;
    padding: 0.55rem 0.65rem;
  }

  #undoButton {
    border: 1px solid var(--line-strong);
    color: var(--ink);
    grid-column: 1;
    order: 1;
  }

  #detailAcceptButton {
    background: var(--cobalt);
    border: 1px solid var(--cobalt);
    color: white;
    grid-column: 2;
    order: 2;
  }

  #detailAcceptButton:hover,
  #detailAcceptButton:focus-visible,
  #detailAcceptButton:active {
    background: var(--cobalt-dark);
    color: white;
  }

  #detailAcceptButton kbd,
  #undoButton kbd {
    display: none;
  }

  .swipe-guide {
    background: var(--paper-muted);
    border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
    order: 3;
  }

  .swipe-guide span {
    color: var(--ink-muted);
    display: grid;
    font-size: 0.61rem;
    gap: 0.12rem;
    min-width: 0;
    padding: 0.42rem 0.25rem;
    text-align: center;
  }

  .swipe-guide span + span {
    border-left: 1px solid var(--line);
  }

  .swipe-guide strong {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.08em;
  }

  #detailsButton {
    color: var(--cobalt);
    grid-column: 1 / -1;
    justify-self: center;
    min-height: 2.75rem;
    order: 4;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    width: auto;
  }

  #detailsButton span {
    display: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  button,
  a {
    cursor: pointer;
  }
}

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