/* ==========================================================================
   Components — ankitjha shadcn-style surface kit
   ========================================================================== */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Let the main area absorb the spare height so short pages keep the footer
   pinned to the bottom of the viewport. */
main#app {
  flex: 1 0 auto;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 78%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  transition: background-color 0.25s ease, box-shadow 0.25s ease,
    border-color 0.25s ease;
}

/* Gains a little depth once content scrolls underneath it. */
.site-header.is-scrolled {
  background: color-mix(in oklab, var(--background) 90%, transparent);
  border-bottom-color: color-mix(in oklab, var(--border) 72%, transparent);
  box-shadow: 0 14px 34px -26px rgb(9 18 28 / 0.55);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1rem;
  white-space: nowrap;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(
    145deg,
    color-mix(in oklab, var(--primary) 82%, #fff),
    var(--primary)
  );
  color: var(--primary-foreground);
  box-shadow: 0 8px 18px -10px color-mix(in oklab, var(--primary) 90%, transparent),
    inset 0 1px 0 rgb(255 255 255 / 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand:hover .brand__mark {
  transform: translateY(-1px) rotate(-2deg);
  box-shadow: 0 12px 22px -10px color-mix(in oklab, var(--primary) 90%, transparent),
    inset 0 1px 0 rgb(255 255 255 / 0.4);
}

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

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

.nav__link {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  transition: color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav__link:hover {
  color: var(--foreground);
  background: var(--muted);
}

.nav__link svg {
  width: 15px;
  height: 15px;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown__panel {
  position: absolute;
  top: calc(100% + 10px);
  /* Anchor to the right edge of the trigger: the button lives at the far right
     of the header, so growing leftwards keeps the panel on screen. */
  right: 0;
  left: auto;
  min-width: 620px;
  max-width: calc(100vw - 32px);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--popover);
  color: var(--popover-foreground);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 18px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  z-index: 60;
}

.dropdown:hover .dropdown__panel,
.dropdown:focus-within .dropdown__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__group-title {
  grid-column: 1 / -1;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 10px 8px 4px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}

.dropdown__group-title:first-child {
  border-top: 0;
  margin-top: 0;
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 0.8438rem;
  color: var(--muted-foreground);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown__item:hover {
  background: var(--muted);
  color: var(--foreground);
}

.dropdown__item svg {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.8;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease, background-color 0.15s ease,
    opacity 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn--secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn--outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
  box-shadow: none;
}

.btn--outline:hover:not(:disabled) {
  background: var(--muted);
  filter: none;
}

.btn--ghost {
  background: transparent;
  color: var(--muted-foreground);
  box-shadow: none;
}

.btn--ghost:hover:not(:disabled) {
  background: var(--muted);
  color: var(--foreground);
  filter: none;
}

.btn--sm {
  height: 34px;
  padding: 0 13px;
  font-size: 0.8438rem;
  border-radius: 10px;
}

.btn--lg {
  height: 48px;
  padding: 0 26px;
  font-size: 1rem;
  border-radius: 14px;
}

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
}

.btn--block {
  width: 100%;
}

/* ---------- Cards ---------- */

.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-sm);
}

.card--pad {
  padding: 22px;
}

.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.card__hint {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

/* ---------- Page heading (reference site pattern) ---------- */

.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.page-head__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--muted);
  flex: none;
}

.page-head__icon svg {
  width: 22px;
  height: 22px;
}

.page-head__eyebrow {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.page-head__title {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin-bottom: 18px;
}

.breadcrumb a:hover {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.breadcrumb svg {
  width: 13px;
  height: 13px;
  opacity: 0.6;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: 68px 20px 46px;
}

/* Decorative light bloom behind the headline. */
.hero__glow {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: -140px;
  width: min(780px, 92vw);
  height: 440px;
  transform: translateX(-50%);
  pointer-events: none;
  background: radial-gradient(
      closest-side,
      color-mix(in oklab, var(--primary) 26%, transparent),
      transparent 74%
    ),
    radial-gradient(
      closest-side at 72% 46%,
      color-mix(in oklab, #00b4bb 18%, transparent),
      transparent 72%
    );
  filter: blur(10px);
  opacity: 0.85;
}

.hero__title {
  font-size: clamp(2.15rem, 5.4vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
  max-width: 20ch;
  margin-inline: auto;
  background: linear-gradient(
    180deg,
    var(--foreground) 18%,
    color-mix(in oklab, var(--foreground) 68%, transparent)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__title-accent {
  background: linear-gradient(
    100deg,
    var(--primary),
    color-mix(in oklab, #00b4bb 78%, var(--primary))
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  margin: 20px auto 0;
  max-width: 60ch;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--muted-foreground);
}

.hero__cta {
  margin-top: 30px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Small nudge on the trailing arrow of the primary CTA. */
.btn__trail {
  transition: transform 0.18s ease;
}

.btn:hover .btn__trail {
  transform: translateX(3px);
}

.hero__stats {
  margin: 40px auto 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 72%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-sm);
  color: var(--muted-foreground);
  font-size: 0.7rem;
}

.hero__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
  padding: 8px 22px;
  text-align: center;
}

.hero__stat + .hero__stat {
  border-left: 1px solid var(--border);
}

.hero__stat strong {
  display: block;
  font-size: 1.2rem;
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.hero__stat span {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.62rem;
  font-weight: 500;
}

/* ---------- Search field ---------- */

.tool-browser {
  padding-bottom: 24px;
}

.search-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: min(440px, 100%);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--card) 84%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.search-field:focus-within {
  border-color: color-mix(in oklab, var(--primary) 52%, var(--border));
  background: var(--card);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary) 13%, transparent),
    var(--shadow-sm);
}

.search-field__icon {
  position: absolute;
  left: 15px;
  width: 17px;
  height: 17px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-field__input {
  width: 100%;
  padding: 12px 46px 12px 42px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  font-size: 0.9rem;
  outline: none;
  color: var(--foreground);
}

.search-field__input::placeholder {
  color: var(--muted-foreground);
}

.search-field__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-field__kbd {
  position: absolute;
  right: 12px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-family: var(--font-geist-mono), ui-monospace, monospace;
  font-size: 0.7rem;
  line-height: 1;
}

.tool-browser__count {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.tool-grid-wrap {
  margin-top: 18px;
}

/* ---------- Filter chips ---------- */

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 26px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.chip__dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 999px;
}

.chip__dot--all {
  background: conic-gradient(
    from 210deg,
    var(--cat-organize),
    var(--cat-optimize),
    var(--cat-convert),
    var(--cat-edit),
    var(--cat-security),
    var(--cat-organize)
  );
}

.chip:hover {
  color: var(--foreground);
  border-color: color-mix(in oklab, var(--foreground) 22%, transparent);
  transform: translateY(-1px);
}

.chip.is-active {
  background: var(--primary);
  border-color: transparent;
  color: var(--primary-foreground);
  font-weight: 500;
  box-shadow: 0 8px 18px -12px color-mix(in oklab, var(--primary) 95%, transparent);
}

/* ---------- Tool grid ---------- */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  transition: background-color 0.18s ease, transform 0.18s ease,
    box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
  animation: tool-card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 18ms);
}

/* Staggered entrance. Ends fully visible, so the page is never blank even
   if individual animations are interrupted. */
@keyframes tool-card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Category-coloured hairline that lights up on hover. */
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0 16% auto 16%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--cat, var(--primary)),
    transparent
  );
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.tool-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in oklab, var(--cat, var(--primary)) 14%, transparent),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.tool-card:hover {
  background: color-mix(in oklab, var(--muted) 55%, var(--card));
  border-color: color-mix(in oklab, var(--cat, var(--primary)) 32%, var(--border));
  transform: translateY(-3px);
  box-shadow: 0 22px 44px -30px color-mix(in oklab, var(--cat, var(--primary)) 80%, transparent),
    var(--shadow-md);
}

.tool-card:hover::before {
  opacity: 0.9;
}

.tool-card:hover::after {
  opacity: 1;
}

.tool-card:focus-visible {
  border-color: color-mix(in oklab, var(--cat, var(--primary)) 45%, var(--border));
}

.tool-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tool-card__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: color-mix(in oklab, var(--cat, var(--primary)) 15%, transparent);
  color: var(--cat, var(--primary));
  flex: none;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--cat, var(--primary)) 20%, transparent);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.tool-card:hover .tool-card__icon {
  transform: scale(1.06) rotate(-2deg);
  background: color-mix(in oklab, var(--cat, var(--primary)) 20%, transparent);
}

.tool-card__icon svg {
  width: 21px;
  height: 21px;
}

.tool-card__arrow {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  transition: transform 0.18s ease, color 0.18s ease;
}

.tool-card:hover .tool-card__arrow {
  transform: translate(-2px, -2px);
  color: var(--cat, var(--primary));
}

.tool-card__name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tool-card__desc {
  font-size: 0.8438rem;
  line-height: 1.55;
  color: var(--muted-foreground);
}

.tool-card__tag {
  align-self: flex-start;
  margin-top: auto;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--cat, var(--primary)) 62%, var(--foreground));
  background: color-mix(in oklab, var(--cat, var(--primary)) 12%, transparent);
}

/* ---------- Tool page ---------- */

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 336px;
  gap: 22px;
  align-items: start;
  padding-bottom: 40px;
}

@media (max-width: 900px) {
  .tool-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool-layout__side {
    position: static !important;
  }
}

.tool-layout__side {
  position: sticky;
  top: 84px;
}

/* Dropzone */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 330px;
  padding: 44px 28px;
  border-radius: var(--radius);
  border: 1.5px dashed color-mix(in oklab, var(--foreground) 20%, transparent);
  background: color-mix(in oklab, var(--card) 80%, transparent);
  text-align: center;
  transition: border-color 0.18s ease, background-color 0.18s ease,
    transform 0.18s ease;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--primary);
  background: color-mix(in oklab, var(--primary) 6%, var(--card));
}

.dropzone.is-over {
  transform: scale(1.005);
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: color-mix(in oklab, var(--primary) 13%, transparent);
  color: var(--primary);
}

.dropzone__icon svg {
  width: 30px;
  height: 30px;
}

.dropzone__title {
  font-size: 1.0625rem;
  font-weight: 600;
}

.dropzone__hint {
  font-size: 0.8438rem;
  color: var(--muted-foreground);
  max-width: 44ch;
  line-height: 1.6;
}

.dropzone input[type="file"] {
  display: none;
}

/* File list */

.filelist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filerow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background-color 0.15s ease;
}

.filerow:hover {
  background: color-mix(in oklab, var(--muted) 55%, var(--card));
}

.filerow__thumb {
  width: 46px;
  height: 58px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--muted);
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  overflow: hidden;
  flex: none;
}

.filerow__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filerow__thumb svg {
  width: 18px;
  height: 18px;
}

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

.filerow__name {
  font-size: 0.9063rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filerow__meta {
  font-size: 0.7813rem;
  color: var(--muted-foreground);
  margin-top: 3px;
}

.filerow__actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ---------- Options panel ---------- */

.panel {
  padding: 20px;
}

.panel__title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.panel__desc {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin-bottom: 18px;
  line-height: 1.5;
}

.field {
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 7px;
}

.field__hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 6px;
  line-height: 1.5;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--input);
  background: color-mix(in oklab, var(--background) 55%, transparent);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
  font-family: var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23434e5b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 34px;
}

.dark .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ea6ae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Segmented control */

.segmented {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--input);
  background: color-mix(in oklab, var(--background) 55%, transparent);
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.segmented button:hover {
  color: var(--foreground);
}

.segmented button.is-active {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
}

/* Switch */

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  cursor: pointer;
  user-select: none;
}

.switch__text {
  font-size: 0.875rem;
}

.switch__text small {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* Keep the checkbox in the accessibility tree and focusable, but invisible. */
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.switch__track {
  width: 40px;
  height: 23px;
  border-radius: 999px;
  background: var(--input);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  flex: none;
}

.switch:hover .switch__track {
  border-color: color-mix(in oklab, var(--primary) 35%, var(--border));
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--foreground) 72%, transparent);
  transition: transform 0.18s ease, background-color 0.18s ease;
  box-shadow: var(--shadow-sm);
}

.switch__track:has(input:checked) {
  background: var(--primary);
  border-color: transparent;
}

.switch__track:has(input:checked)::after {
  transform: translateX(17px);
  background: var(--primary-foreground);
}

.switch__track:has(input:focus-visible) {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Range */

.range {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  appearance: none;
  background: var(--input);
  outline: none;
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--background);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--background);
  cursor: pointer;
}

/* Colour input */

.color {
  width: 100%;
  height: 40px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--input);
  background: color-mix(in oklab, var(--background) 55%, transparent);
  cursor: pointer;
}

/* ---------- Action bar ---------- */

.actionbar {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--popover);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 20;
}

.actionbar__info {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.actionbar__info strong {
  color: var(--foreground);
  font-weight: 600;
}

.actionbar__spacer {
  margin-left: auto;
}

/* ---------- Progress ---------- */

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--input);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--chart-2));
  transition: width 0.25s ease;
}

/* ---------- Result ---------- */

.result {
  padding: 26px;
  text-align: center;
}

.result__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 19px;
  margin-inline: auto;
  background: color-mix(in oklab, var(--chart-4) 18%, transparent);
  color: var(--chart-4);
}

.result__icon svg {
  width: 28px;
  height: 28px;
}

.result__title {
  font-size: 1.375rem;
  font-weight: 600;
  margin-top: 16px;
  letter-spacing: -0.02em;
}

.result__desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 8px;
  line-height: 1.6;
}

.result__stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.stat {
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--muted);
  min-width: 130px;
}

.stat__label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-foreground);
}

.stat__value {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.stat--good .stat__value {
  color: var(--chart-4);
}

.result__actions {
  margin-top: 24px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Toast ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 40px));
}

.toast {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--popover);
  color: var(--popover-foreground);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  font-size: 0.8438rem;
  line-height: 1.5;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 1px;
}

.toast--error svg {
  color: var(--destructive);
}

.toast--success svg {
  color: var(--chart-4);
}

.toast--info svg {
  color: var(--primary);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in oklab, #04070b 55%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease;
}

.modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--popover);
  color: var(--popover-foreground);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.modal__title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal__desc {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 7px;
  line-height: 1.55;
}

.modal__actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---------- Page grid / thumbnails ---------- */

.pagegrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}

.pagecard {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--muted);
  padding: 9px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  user-select: none;
}

.pagecard:hover {
  transform: translateY(-2px);
}

.pagecard.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 30%, transparent);
}

.pagecard.is-dragging {
  opacity: 0.4;
}

.pagecard__thumb {
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
}

.pagecard__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pagecard__num {
  position: absolute;
  top: 15px;
  left: 15px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--foreground);
  color: var(--background);
  font-size: 0.6875rem;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.pagecard__check {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--foreground);
  background: var(--background);
  display: grid;
  place-items: center;
}

.pagecard.is-selected .pagecard__check {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

.pagecard__check svg {
  width: 12px;
  height: 12px;
  opacity: 0;
}

.pagecard.is-selected .pagecard__check svg {
  opacity: 1;
}

.pagecard__bar {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  justify-content: center;
}

.pagecard__bar button {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 3px;
  border-radius: 6px;
}

.pagecard__bar button:hover {
  background: var(--card);
  color: var(--foreground);
}

.pagecard__bar svg {
  width: 14px;
  height: 14px;
}

/* ---------- Signature pad ---------- */

.sigpad {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--input);
  background: color-mix(in oklab, var(--background) 55%, transparent);
  overflow: hidden;
}

.sigpad__canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 14 / 5;
  touch-action: none;
  cursor: crosshair;
  background-image: linear-gradient(
      to bottom,
      transparent calc(100% - 26px),
      color-mix(in oklab, var(--muted-foreground) 18%, transparent) calc(100% - 26px),
      transparent calc(100% - 25px)
    ),
    linear-gradient(to right, transparent 32px, color-mix(in oklab, var(--muted-foreground) 12%, transparent) 32px, transparent 33px);
}

.sigpad__file {
  display: block;
  width: 100%;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.sigpad__file::file-selector-button {
  margin-right: 10px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.sigpad__preview {
  margin-top: 12px;
  display: grid;
  place-items: center;
  min-height: 60px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed color-mix(in oklab, var(--foreground) 18%, transparent);
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.sigpad__preview img {
  max-width: 100%;
  max-height: 120px;
  display: block;
}

/* ---------- Misc ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--muted-foreground);
}

.badge--pdf {
  background: color-mix(in oklab, var(--destructive) 14%, transparent);
  color: var(--destructive);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}

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

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

.mono {
  font-family: var(--font-geist-mono), ui-monospace, SFMono-Regular, Menlo, monospace;
}

.note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted-foreground);
}

.note svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
}

.note--warn {
  background: color-mix(in oklab, #c19900 12%, transparent);
  color: color-mix(in oklab, #c19900 70%, var(--foreground));
}

/* ---------- Feature strip ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  padding: 40px 0 10px;
}

.feature {
  position: relative;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.feature:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--fc, var(--primary)) 30%, var(--border));
  box-shadow: var(--shadow-md);
}

.feature__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in oklab, var(--fc, var(--primary)) 14%, transparent);
  color: var(--fc, var(--primary));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--fc, var(--primary)) 18%, transparent);
  margin-bottom: 14px;
}

.feature__icon svg {
  width: 18px;
  height: 18px;
}

.feature__title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.feature__text {
  margin-top: 7px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--border);
  padding: 40px 0 26px;
  font-size: 0.8438rem;
  color: var(--muted-foreground);
  background: color-mix(in oklab, var(--card) 34%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.25fr;
  gap: 36px;
  align-items: start;
}

.site-footer__brand .brand {
  margin-bottom: 12px;
}

.site-footer__tagline {
  max-width: 36ch;
  font-size: 0.82rem;
  line-height: 1.6;
}

.site-footer__note {
  margin-top: 8px;
  max-width: 38ch;
  font-size: 0.75rem;
  line-height: 1.55;
  color: color-mix(in oklab, var(--muted-foreground) 86%, transparent);
}

.site-footer__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 500;
}

.site-footer__pill svg {
  width: 13px;
  height: 13px;
}

.site-footer__col {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.site-footer__col a {
  width: fit-content;
}

.site-footer__title {
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--foreground);
}

.site-footer a:hover {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Developer credit card — the one place the name is always spelled out. */
.dev-credit {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.dev-credit:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--primary) 32%, var(--border));
  box-shadow: var(--shadow-md);
}

.dev-credit__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary-foreground);
  background: linear-gradient(135deg, var(--primary), #00b4bb);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3);
}

.dev-credit__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dev-credit__meta strong {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--foreground);
}

.dev-credit__meta small {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

.dev-credit__icon {
  margin-left: auto;
  width: 16px;
  height: 16px;
  flex: none;
  opacity: 0.55;
  transition: opacity 0.18s ease;
}

.dev-credit:hover .dev-credit__icon {
  opacity: 1;
}

.dev-credit__note {
  margin-top: 10px;
  font-size: 0.72rem;
  line-height: 1.5;
}

.site-footer__bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
}

.site-footer__sep {
  opacity: 0.5;
}

.site-footer__made {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-footer__heart {
  width: 13px;
  height: 13px;
  color: var(--cat-security);
  fill: color-mix(in oklab, var(--cat-security) 80%, transparent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-foreground);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  background: var(--muted);
  color: var(--foreground);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun {
  display: none;
}

.dark .theme-toggle .icon-sun {
  display: block;
}

.dark .theme-toggle .icon-moon {
  display: none;
}

@media (max-width: 860px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .hide-sm {
    display: none !important;
  }
  /* Anchor the panel to the full-width header instead of the trigger button,
     which sits too far right for the panel to fit beside it. */
  .dropdown {
    position: static;
  }
  .dropdown__panel {
    top: 100%;
    left: 12px;
    right: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero {
    padding: 40px 20px 30px;
  }
  .hero__stats {
    width: 100%;
  }
  .hero__stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px 10px;
  }
  .page-head__title {
    font-size: 1.5rem;
  }
  .actionbar {
    flex-wrap: wrap;
  }
  .actionbar__spacer {
    display: none;
  }
  .actionbar .btn {
    flex: 1;
  }
}

@media (max-width: 560px) {
  .site-footer {
    padding-top: 32px;
  }
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    padding: 8px;
  }
  .hero__stat {
    padding: 8px 6px;
  }
  .hero__stat + .hero__stat {
    border-left: 0;
  }
  .hero__stat:nth-child(even) {
    border-left: 1px solid var(--border);
  }
  .hero__stat:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }
}
