:root {
  color-scheme: light;
  /* #1f6ae4 rather than a brighter blue: white label text and blue text on a
     white card both need 4.5:1, and this is the same hue at the point where
     they clear it. */
  --primary: #1f6ae4;
  --primary-hover: #1a5cc4;
  --primary-soft: #eaf2fe;
  --ink: #17233a;
  --ink-soft: #5b6b81;
  /* Reads as "quiet grey" on white but still clears 4.5:1, so the small
     uppercase labels and notes built on it stay legible. */
  --muted: #6b7688;
  --placeholder: #9aa8bd;
  --bg: #f4f6fb;
  --bg-soft: #f1f5fb;
  --raised: #eceff4;
  --card: #ffffff;
  --border: #e4e9f2;
  --danger: #d4441f;
  --danger-soft: rgba(212, 68, 31, 0.08);
  --gold: #f2b134;
  --green: #18a35a;
  --green-soft: rgba(24, 163, 90, 0.1);
  --btn: var(--primary);
  --btn-hover: var(--primary-hover);
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Views are toggled with el.hidden; a class-level display would otherwise win. */
[hidden] { display: none !important; }

/* Dark theme. Component rules below read the variables, so the base palette
   swap covers most surfaces; hardcoded light colors get their own overrides at
   the end of this file. */
[data-theme="dark"] {
  color-scheme: dark;
  --primary: #4d9fff;
  --primary-hover: #6cb0ff;
  --primary-soft: rgba(77, 159, 255, 0.15);
  --ink: #e7edf8;
  --ink-soft: #9dabc2;
  --muted: #8493ab;
  --placeholder: #7e8da5;
  /* A deliberate four-step ramp so surfaces separate without relying on borders
     alone: page < inset < card < control. The previous values sat within a few
     lightness points of each other, which made every panel read as flat. */
  --bg: #0a101a;
  --bg-soft: #0f1724;
  --raised: #1e2939;
  --card: #141d2b;
  --border: #28334a;
  --danger: #ff7f63;
  --danger-soft: rgba(255, 127, 99, 0.13);
  --gold: #f5bd4d;
  --green: #3ddc84;
  --green-soft: rgba(61, 220, 132, 0.14);
  /* Bright --primary reads well as an accent on dark, but white label text
     needs a deeper fill to stay legible. */
  --btn: #2563eb;
  --btn-hover: #1d4ed8;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  padding: 6px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  color: var(--primary);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.brand-dot { color: var(--primary); }

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 360px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.header-search > svg { color: var(--placeholder); flex-shrink: 0; }

#search {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: transparent;
}

#search::placeholder { color: var(--placeholder); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.header-nav > a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.15s;
}

.header-nav > a:hover,
.header-nav > a.nav-active { color: var(--primary); }

.nav-drop { position: relative; }

.nav-drop-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 0;
  transition: color 0.15s;
}

.nav-drop-btn:hover { color: var(--primary); }

.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(23, 35, 58, 0.12);
  padding: 6px;
  z-index: 60;
}

.nav-drop:hover .nav-drop-menu,
.nav-drop:focus-within .nav-drop-menu { display: block; }

/* The 8px offset below is a dead strip the pointer has to cross on its way into
   the menu, and :hover drops the moment it does — the menu closed before it
   could be reached. This child of the menu bridges the gap, so the hover chain
   stays unbroken all the way down to the links. */
.nav-drop-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 10px;
}

.nav-drop-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
}

.nav-drop-menu a:hover { background: var(--primary-soft); color: var(--primary); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  min-width: 0;
}

/* The homepage opens directly on the grid, so its h1 exists only for the
   document outline and screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

/* One heading rhythm for every homepage section: title at the left edge, an
   optional link at the right edge, one line of context underneath. */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary-hover);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.section-link svg { flex: none; }

.section-link:hover { text-decoration: underline; }

.section-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

.section-note {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
  max-width: 62ch;
  margin-top: 4px;
}

.empty {
  text-align: center;
  padding: 48px 0;
  color: var(--ink-soft);
}

/* Catalog: the page's main surface. The online-tools block opens the page now,
   so this section starts flush and only carries bottom spacing. */
.catalog { padding: 0 0 44px; scroll-margin-top: 76px; }

/* One framed panel per category, holding a single row that scrolls sideways.
   The panel sits on --bg-soft so the --card surfaces inside it keep their depth
   in both themes; app.js moves a vertical wheel onto the row and only shows the
   arrows when the cards actually overflow. */
.cat-group + .cat-group { margin-top: 20px; }

.cat-group {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 5px);
  padding: 15px 16px 3px;
}

.cat-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.cat-group-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cat-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slider-nav { display: flex; gap: 7px; margin-left: auto; align-self: center; }

.slider-arrow {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, opacity 0.15s;
}

.slider-arrow:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.slider-arrow:disabled { opacity: 0.35; cursor: default; }
.slider-arrow:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* No scroll-snap here on purpose: the wheel handler below writes scrollLeft in
   small increments, and snapping keeps pulling the row back to the nearest card
   edge, which undoes the gesture the visitor is still making. */
.cat-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 14px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.cat-track::-webkit-scrollbar { height: 6px; }
.cat-track::-webkit-scrollbar-track { background: transparent; }
.cat-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Cards never shrink: a row that has more cards than fits must keep its overflow,
   because that overflow is what the wheel and the arrows act on. They may grow,
   but only into space a row already has to spare, so a short category fills its
   panel instead of stranding half of it. */
.cat-track .card {
  flex: 1 0 clamp(228px, 62vw, 282px);
  max-width: 380px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(23, 35, 58, 0.07);
}

.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.card-top { display: flex; align-items: center; gap: 13px; }

/* Descriptions vary in length and a grid row stretches to the tallest card, so
   the leftover space is given a real job: the source domain on the left, the
   arrow on the right, both pinned to the bottom edge behind a hairline. The
   arrow is always visible rather than hover-only so touch users get the cue. */
.card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--muted);
}

.card-src {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.card-go {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--placeholder);
  transition: color 0.15s, transform 0.15s;
}

.card:hover .card-go { color: var(--primary); transform: translateX(3px); }

.mono {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.mono-logo {
  background: #fff;
  border: 1px solid var(--border);
  padding: 7px;
}

.mono-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-name { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }

.card-cat {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-desc {
  color: var(--ink-soft);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); }

.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* 404 */
.notfound {
  max-width: 560px;
  margin: 0 auto;
  padding: 72px 0 96px;
  text-align: center;
}

.nf-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 30px 32px;
  box-shadow: 0 10px 30px rgba(23, 35, 58, 0.08);
}

.nf-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--primary) 22%, var(--primary-hover) 50%, var(--primary) 78%, transparent);
  opacity: .55;
}

.nf-art {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
}

.nf-art-mark {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--card);
  background: var(--btn);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

/* A compact code rather than a giant ghost numeral: the oversized version
   collided with the icon above it and read as a decorative hero. */
.notfound-code {
  display: inline-block;
  margin-bottom: 14px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.1em;
}

.notfound-title { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }

.notfound-text { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.65; max-width: 42ch; margin: 0 auto 20px; }

.nf-path { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; }

.nf-path-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.nf-path-value {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
}

.nf-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto 16px;
  padding: 7px 7px 7px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.nf-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.nf-search > svg { color: var(--placeholder); flex-shrink: 0; }

.nf-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
}

.nf-search input::placeholder { color: var(--placeholder); }

.nf-search button {
  flex-shrink: 0;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  background: var(--btn);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.nf-search button:hover { background: var(--btn-hover); }

.nf-chips-label { font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }

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

.nf-chip {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nf-chip:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.notfound-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

@media (max-width: 480px) {
  .notfound { padding: 40px 0 64px; }
  .nf-card { padding: 30px 18px 26px; }
  .notfound-code { font-size: 0.74rem; }
  .notfound-title { font-size: 1.25rem; }
  .nf-search { padding-left: 11px; }
  .notfound-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Premium payment page */
.page-payment .dl-main {
  background:
    radial-gradient(560px 280px at 50% -80px, rgba(242, 177, 52, 0.18), transparent 70%),
    radial-gradient(760px 340px at 88% 6%, rgba(36, 114, 242, 0.07), transparent 72%);
}

.page-payment .dl-card { max-width: 620px; }

.pm-card {
  padding: 0;
  overflow: hidden;
  border-color: #eadfc4;
  box-shadow: 0 18px 44px rgba(122, 88, 15, 0.12);
}

.pm-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 26px 22px;
  background: linear-gradient(135deg, #fffdf6 0%, #fdf3d8 45%, #f8e3ac 100%);
  border-bottom: 1px solid #eedaa9;
}

.pm-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), #e0a526 55%, #f7d488);
}

.pm-hero-star {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffd766, var(--gold) 45%, #d99a1f);
  color: #4a3203;
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(217, 154, 31, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.pm-hero-copy { min-width: 0; }

.pm-hero-kicker {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #8a6110;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #eedaa9;
  border-radius: 999px;
  padding: 3px 9px;
  margin-bottom: 7px;
}

.pm-hero-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.015em; line-height: 1.2; }

.pm-hero-sub { font-size: 0.84rem; color: #8a6a25; margin-top: 4px; }

.pm-hero-price {
  margin-left: auto;
  text-align: right;
  line-height: 1.05;
  background: #fff;
  border: 1px solid #eedaa9;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(122, 88, 15, 0.1);
}

.pm-hero-price span {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  color: #7d5406;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pm-hero-price small {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #a9853c;
}

.pm-hero--done {
  background: linear-gradient(135deg, #f4fbf6 0%, #e2f6e9 55%, #cdeeda 100%);
  border-bottom-color: #bfe4cd;
}

.pm-hero--done::before { background: linear-gradient(90deg, var(--green), #35c07a 60%, #a8e6c4); }

.pm-hero--done .pm-hero-star {
  background: linear-gradient(135deg, #4ed08c, var(--green) 55%, #0f8347);
  color: #fff;
  box-shadow: 0 8px 18px rgba(24, 163, 90, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.pm-hero--done .pm-hero-kicker { color: #0f7a43; border-color: #bfe4cd; background: rgba(255, 255, 255, 0.75); }

.pm-hero--done .pm-hero-sub { color: #3d7a58; }

.pm-body { padding: 24px 26px 26px; }
.pm-lede { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.6; margin-bottom: 18px; }
.pm-warn { margin-bottom: 14px; }

.pm-bank {
  background: linear-gradient(180deg, #f4f9ff, var(--primary-soft));
  border: 1px solid #cfe1fd;
  border-radius: 14px;
  padding: 14px 16px 16px;
  margin-bottom: 20px;
}

.pm-bank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.pm-bank-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.pm-bank-label svg { flex: 0 0 auto; }
.pm-bank-holder { font-size: 0.78rem; color: var(--ink-soft); }
.pm-bank-row { display: flex; align-items: center; gap: 10px; }

.pm-bank-value {
  flex: 1;
  margin-bottom: 0;
  background: #fff;
  border-color: #cfe1fd;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.pm-copy {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pm-copy:hover { background: var(--btn); color: #fff; }
.pm-copy.is-copied { background: var(--green); border-color: var(--green); color: #fff; }

.pm-steps {
  position: relative;
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.pm-steps li { position: relative; display: flex; align-items: flex-start; gap: 12px; }

.pm-steps li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: -14px;
  width: 2px;
  background: linear-gradient(180deg, #cfe1fd, rgba(207, 225, 253, 0));
}

.pm-steps strong { color: var(--ink); }

.pm-step-num {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--btn);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  margin-top: 1px;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.pm-confirm {
  border: 1px solid #eedaa9;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf6, #fff7e6);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 #fff;
}

.pm-confirm-q { font-size: 0.98rem; font-weight: 800; color: var(--ink); margin-bottom: 12px; }
.pm-confirm-actions { display: flex; flex-direction: column; gap: 8px; }
.pm-confirm-actions .auth-submit { margin: 0; }

.auth-submit.pm-primary {
  background: linear-gradient(135deg, #ffd766, var(--gold) 40%, #d99a1f);
  color: #3d2a03;
  font-size: 1.02rem;
  font-weight: 800;
  padding: 14px 0;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(217, 154, 31, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.auth-submit.pm-primary:hover {
  background: linear-gradient(135deg, #ffdf85, #f5bd4d 40%, #e0a526);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(217, 154, 31, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.auth-submit.pm-primary:active { transform: translateY(0); box-shadow: 0 4px 10px rgba(217, 154, 31, 0.28); }
.auth-submit.pm-primary:disabled { filter: grayscale(0.35) brightness(1.03); box-shadow: none; transform: none; }

.pm-ghost {
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}

.pm-ghost:hover { color: var(--ink); border-color: #cfd8e6; }

.pm-confirm-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #8a7a55;
}

.pm-confirm-note svg { flex: 0 0 auto; margin-top: 3px; }

.pm-status {
  position: relative;
  border-radius: 12px;
  padding: 12px 14px 12px 40px;
  margin-bottom: 16px;
  font-size: 0.88rem;
}

.pm-status::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 15px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.pm-status.info { background: var(--primary-soft); color: #1a4fa8; }
.pm-status.info::before { background: var(--primary); box-shadow: 0 0 0 3px rgba(36, 114, 242, 0.18); }
.pm-status.pending { background: rgba(242, 177, 52, 0.16); color: #8a6110; }

.pm-status.pending::before {
  background: var(--gold);
  animation: pm-pulse 1.6s ease-in-out infinite;
}

.pm-status.rejected { background: var(--danger-soft); color: var(--danger); }
.pm-status.rejected::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(212, 68, 31, 0.15); }

@keyframes pm-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(242, 177, 52, 0.22); }
  50% { box-shadow: 0 0 0 8px rgba(242, 177, 52, 0.06); }
}

.pm-status-title { font-weight: 700; margin-bottom: 4px; }
.pm-status-text { line-height: 1.55; }
.pm-expiry {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}
.pm-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* QPay QR path. Only ever visible when payment_info reports qpay_available;
   without QPAY_* credentials these rules match nothing on the page. */
.pm-choose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.pm-choice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  font: inherit;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.pm-choice:hover { border-color: #dcc99a; }

.pm-choice.is-on {
  background: linear-gradient(180deg, #fffdf6, #fff2d4);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 177, 52, 0.16);
}

.pm-choice-name { font-size: 0.87rem; font-weight: 800; color: var(--ink); }
.pm-choice-sub { font-size: 0.74rem; color: var(--ink-soft); }

.pm-qr {
  border: 1px solid #eedaa9;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf6, #fff7e6);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 0 #fff;
}

.pm-qr-lede { font-size: 0.88rem; line-height: 1.6; color: var(--ink-soft); margin-bottom: 14px; }
.pm-qr-lede strong { color: var(--ink); }

.pm-qr-code { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }

/* A QR scanner needs a plain white field and real quiet zone, so the padding is
   part of readability, not decoration. */
.pm-qr-img {
  flex: 0 0 auto;
  display: block;
  width: 188px;
  height: 188px;
  padding: 10px;
  background: #fff;
  border: 1px solid #e2cfa0;
  border-radius: 12px;
  image-rendering: pixelated;
}

.pm-qr-side { min-width: 0; }
.pm-qr-amount { font-size: 1.45rem; font-weight: 800; color: #3d2a03; font-variant-numeric: tabular-nums; }
.pm-qr-tip { margin-top: 10px; font-size: 0.76rem; line-height: 1.55; color: #7a6a48; }
.pm-qr .pm-status { margin-bottom: 12px; }
.pm-qr .pm-actions { margin-top: 12px; }
.pm-message { margin: 0 0 12px; }

@media (max-width: 480px) {
  /* Ticket-style header: star and price share the top row, copy gets full width. */
  .pm-hero { flex-wrap: wrap; row-gap: 10px; }
  .pm-hero-star { order: 1; }
  .pm-hero-price { order: 2; margin-left: auto; display: flex; align-items: baseline; gap: 8px; }
  .pm-hero-price small { margin-top: 0; }
  .pm-hero-copy { order: 3; flex-basis: 100%; }
  .pm-choose { grid-template-columns: 1fr; }
  .pm-qr-code { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* About */
/* About: a heading column and a definition list, not three matching cards. */
.about {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 44px 0;
}

.about-inner {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 30px 56px;
  align-items: start;
}

.about-head h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.about-head p {
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.about-list { display: grid; gap: 2px; }

.about-item {
  display: grid;
  grid-template-columns: minmax(0, 168px) minmax(0, 1fr);
  gap: 6px 20px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.about-item:first-child { border-top: none; padding-top: 0; }
.about-item:last-child { padding-bottom: 0; }

.about-item dt {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.about-item dd {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Placed after the rules above: a media query adds no specificity, so ordering
   is the only thing that makes these collapse. */
@media (max-width: 820px) {
  .about { padding: 36px 0; }
  .about-inner { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 520px) {
  .about-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Footer */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 26px 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.footer-simple { text-align: center; }

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-brand .brand-name { font-size: 1rem; }
.footer-brand p { font-size: 0.78rem; margin-top: 2px; }

.footer-nav { display: flex; gap: 18px; flex-wrap: wrap; }

.footer-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.footer-nav a:hover { color: var(--primary); }

.footer-copy { font-size: 0.8rem; }

/* One header row needs ~1120px; below that the auth buttons get pushed out of
   the viewport, so split into two rows: brand + auth, then search + nav. */
@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; gap: 8px 24px; min-height: 0; padding: 8px 0 6px; }
  .brand { order: 1; }
  .header-right { order: 2; }
  /* Zero-height line break: search + nav always start the second row. */
  .header-inner::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  .header-search { order: 4; flex: 1 1 220px; max-width: none; }
  .header-nav { order: 5; flex: 0 1 auto; min-width: 0; }
}

@media (max-width: 640px) {
  .container { padding: 0 14px; }

  /* Header wraps into stacked rows: brand + auth, then search, then nav. */
  .header-inner { flex-wrap: wrap; gap: 8px 10px; min-height: 0; padding: 8px 0 6px; }
  .header-inner::after { display: none; }
  .brand { order: 1; }
  .header-right { order: 2; gap: 8px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; padding: 7px 10px; }
  .header-nav {
    order: 4;
    flex-basis: 100%;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .header-nav::-webkit-scrollbar { display: none; }
  .header-nav > a { font-size: 0.82rem; white-space: nowrap; padding: 4px 0; }
  /* The category dropdown opens on hover only, so it is dead weight on touch. */
  .nav-drop { display: none; }

  .auth-name { max-width: 110px; font-size: 0.8rem; }
  .btn-logout { padding: 9px 12px; }
  .btn-auth { padding: 9px 14px; }
  .btn-premium { padding: 8px 10px; font-size: 0.74rem; }
  .btn-premium-price { display: none; }

  .pm-hero { padding: 18px 16px 16px; gap: 12px; }
  .pm-hero-star { width: 42px; height: 42px; border-radius: 13px; font-size: 1.25rem; }
  .pm-hero-kicker { font-size: 0.6rem; padding: 2px 8px; margin-bottom: 5px; }
  .pm-hero-title { font-size: 1.12rem; }
  .pm-hero-sub { font-size: 0.78rem; }
  .pm-hero-price { padding: 8px 12px; border-radius: 12px; }
  .pm-hero-price span { font-size: 1.22rem; }
  .pm-body { padding: 18px 16px 20px; }
  .pm-bank-head { flex-wrap: wrap; gap: 2px 10px; }
  .pm-confirm { padding: 14px; }
  .pm-bank-row { flex-wrap: wrap; }
  .pm-copy { flex: 1 1 100%; }

  /* After the base .section-title rule, so it actually wins at phone width. */
  .section-title { font-size: 1.15rem; }
  /* The link is nowrap, so without this it is pushed past the right edge of a
     390px viewport instead of dropping under the title. */
  .section-head { align-items: flex-start; gap: 4px 10px; flex-wrap: wrap; }
  .about-head h2 { font-size: 1.15rem; }

  .cat-group { padding: 13px 12px 2px; }
  .cat-track { gap: 10px; padding: 12px 0 10px; }
  .card { padding: 16px; gap: 10px; }
  .card-top { gap: 12px; }
  .card-name { font-size: 1rem; }
  .card-desc { -webkit-line-clamp: 2; font-size: 0.86rem; }

  /* Sticky header is taller once it wraps, so anchor targets need more room. */
  .tools-section { padding: 20px 0 24px; margin-bottom: 24px; }
  .catalog { padding: 0 0 36px; scroll-margin-top: 172px; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }

  .auth-page { padding: 28px 0 44px; }
  .auth-card { padding: 20px; }

  /* iOS zooms the whole page when a focused control is under 16px. */
  input,
  select,
  textarea { font-size: 16px; }
  .btn,
  .btn-auth,
  .btn-logout { font-size: 0.88rem; }
}

/* Auth */
.auth-area { display: flex; align-items: center; gap: 10px; min-width: 0; }

.btn-auth {
  padding: 8px 18px;
  border-radius: 9px;
  border: none;
  background: var(--btn);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

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

.auth-user { display: flex; align-items: center; gap: 10px; min-width: 0; }

.auth-name {
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn-logout:hover { color: var(--danger); border-color: var(--danger); }

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 35, 58, 0.5);
  backdrop-filter: blur(4px);
}

.auth-overlay[hidden] { display: none; }

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 24px 60px rgba(23, 35, 58, 0.3);
}

.auth-modal h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.auth-close:hover { background: var(--bg); color: var(--ink); }

.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-tab[aria-selected="true"] {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(23, 35, 58, 0.15);
}

.auth-form { display: flex; flex-direction: column; gap: 6px; }

.auth-field { display: flex; flex-direction: column; }
.auth-field[hidden] { display: none; }

.auth-label { font-size: 0.83rem; font-weight: 600; color: var(--ink-soft); }

.auth-input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 8px;
}

.auth-input:focus { border-color: var(--primary); }

.auth-hint { font-size: 0.76rem; color: var(--ink-soft); margin-bottom: 8px; }

.auth-message {
  font-size: 0.83rem;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.auth-submit {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 0;
  border: none;
  border-radius: 10px;
  background: var(--btn);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.auth-submit:hover { background: var(--btn-hover); }
.auth-submit:disabled { opacity: 0.6; cursor: wait; }

/* Standalone sign-in / sign-up pages */
.auth-page {
  min-height: calc(100vh - 160px);
  padding: 56px 0 64px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: 0 12px 34px rgba(23, 35, 58, 0.08);
}

.auth-card-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.auth-card-sub {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.auth-alt {
  margin-top: 18px;
  text-align: center;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.auth-alt a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

.auth-forgot { text-align: right; margin: -4px 0 10px; }

.auth-forgot a {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-forgot a:hover { text-decoration: underline; }

/* Forgot-password card: step bars, the 6-digit code field and inline actions. */
.auth-steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; }

.auth-step {
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s;
}

.auth-step.is-on { background: var(--primary); }
.auth-step.is-done { background: var(--btn); }

.auth-code {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-align: center;
  /* Offsets the trailing letter-space so the digits stay optically centred. */
  padding-left: 0.42em;
}

.auth-linkbtn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

.auth-linkbtn:hover:not(:disabled) { text-decoration: underline; }
.auth-linkbtn:disabled { color: var(--muted); cursor: wait; }
.auth-alt-sep { color: var(--ink-soft); margin: 0 6px; }

/* Confirm dialog (logout) */
.confirm-modal { text-align: center; max-width: 360px; }

.confirm-text {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 22px;
}

.confirm-actions { display: flex; gap: 10px; }

.confirm-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.confirm-cancel { background: var(--bg); color: var(--ink-soft); border-color: var(--border); }
.confirm-cancel:hover { background: var(--raised); color: var(--ink); }
.confirm-ok { background: var(--btn); color: #fff; }
.confirm-ok:hover { background: var(--btn-hover); }
.confirm-ok:disabled { opacity: 0.6; cursor: wait; }

/* Shared detail styles (program page) */
.app-detail-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.app-detail-list {
  margin: 0 0 18px 20px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.app-detail-list li { margin-bottom: 5px; }

/* Premium */
.premium-badge {
  padding: 4px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #d99a1f);
  color: #17233a;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.btn-premium {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: rgba(242, 177, 52, 0.14);
  color: #b57d10;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-premium:hover { background: rgba(242, 177, 52, 0.26); }

/* The payment page is the destination, so it does not advertise itself. */
.page-payment .btn-premium { display: none; }

/* Download page */
.dl-main {
  min-height: calc(100vh - 160px);
  padding: 48px 0 64px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.dl-container { width: 100%; }

.dl-card {
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 10px 30px rgba(23, 35, 58, 0.08);
}

.dl-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.dl-mono {
  width: 64px;
  height: 64px;
  border-radius: 14px;
}

.dl-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.dl-desc {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.dl-state { border-top: 1px solid var(--border); padding-top: 20px; }

.dl-gate-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dl-gate-desc {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.dl-unlocked-note {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.dl-download-btn {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 13px 20px;
}

.dl-source-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 12px;
  text-align: center;
}

.dl-notfound { text-align: center; }
.dl-notfound .btn { display: inline-flex; margin-top: 8px; }

/* Program page */
.pg-main { padding: 32px 0 56px; }

.pg-card {
  max-width: 860px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(23, 35, 58, 0.07);
  padding: 30px;
}

.pg-hero {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.pg-hero-mono {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  font-size: 2rem;
}

.pg-hero-mono.mono-logo { padding: 12px; }

.pg-hero-info { flex: 1; min-width: 0; }

.pg-name {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.pg-desc {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin: 10px 0 18px;
}

.pg-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.pg-download {
  padding: 12px 26px;
  font-size: 1rem;
  gap: 8px;
}

.pg-gate-hint {
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 46ch;
}

.pg-note {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.pg-long {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 24px 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.pg-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.pg-list { margin-bottom: 0; }

.pg-related { margin-top: 30px; }

.pg-related-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.pg-related-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  transition: border-color 0.15s, transform 0.15s;
}

.pg-related-card:hover { border-color: var(--primary); transform: translateY(-2px); }

.pg-related-mono { width: 34px; height: 34px; border-radius: 9px; font-size: 0.85rem; }
.pg-related-mono.mono-logo { padding: 4px; }

.pg-related-name { font-size: 0.88rem; font-weight: 600; }

/* Premium step-by-step guide */
.pg-guide {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.pg-guide-head { margin-bottom: 12px; }

.pg-guide-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #f4a642, #e8842a);
  border-radius: 999px;
  vertical-align: middle;
}

.pg-guide:not(.locked) .pg-guide-lock-ico { display: none; }
.pg-guide.locked .pg-guide-badge { background: linear-gradient(135deg, #b8bfc9, #98a1ae); }

.pg-guide-intro {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 14px;
}

.pg-guide-steps {
  list-style: none;
  counter-reset: pgstep;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pg-guide-step {
  counter-increment: pgstep;
  position: relative;
  padding: 12px 14px 12px 46px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
}

.pg-guide-step::before {
  content: counter(pgstep);
  position: absolute;
  left: 12px;
  top: 11px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: var(--btn);
  border-radius: 50%;
}

/* Locked / blurred state */
.pg-guide.locked .pg-guide-steps { display: none; }

.pg-guide-blur {
  position: relative;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  filter: blur(5px);
  opacity: 0.7;
  pointer-events: none;
  user-select: none;
  margin-bottom: -68px;
}

.pg-guide-skel { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pg-guide-skel:last-child { margin-bottom: 0; }
.pg-guide-skel span { display: block; height: 12px; border-radius: 6px; background: #cfd6df; }
.pg-guide-skel span:nth-child(1) { width: 92%; }
.pg-guide-skel span:nth-child(2) { width: 78%; }
.pg-guide-skel span:nth-child(3) { width: 85%; }
.pg-guide-skel span:nth-child(4) { width: 60%; }

.pg-guide-lock {
  position: relative;
  z-index: 1;
  margin-top: 60px;
  padding: 18px;
  background: linear-gradient(160deg, #fff8ec, #fdeecd);
  border: 1px solid #f0d9a8;
  border-radius: 12px;
  text-align: center;
}

.pg-guide-lock-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #6b5216;
  margin: 0 0 14px;
}

.pg-guide-cta { width: 100%; justify-content: center; }

@media (max-width: 680px) {
  .pg-guide-cta { width: 100%; }
}

.pg-notfound { max-width: 560px; margin: 40px auto; }

@media (max-width: 680px) {
  .pg-card { padding: 22px; }
  .pg-hero { flex-direction: column; gap: 16px; }
  .pg-hero-mono { width: 76px; height: 76px; font-size: 1.6rem; }
  .pg-name { font-size: 1.4rem; }
  .pg-cols { grid-template-columns: 1fr; gap: 22px; }
  .pg-download { width: 100%; justify-content: center; }
}

/* Online tools. The homepage section and the /tools/ hub directory render the
   same rows, so the card look is defined once here. On the homepage this block
   opens the page, so it takes the top spacing and divides itself off with a
   rule — the program grid below it has no heading of its own. */
.tools-section {
  padding: 28px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.tools-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

/* After the rule above on purpose: a media query adds no specificity. */
@media (max-width: 860px) {
  .tools-list { grid-template-columns: minmax(0, 1fr); }
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tool-row:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(23, 35, 58, 0.06);
}

.tool-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* No tinted chip behind the mark: the icon carries its own colour, and a
   pastel rounded square under every row is what made the list look generated. */
.tool-row-ico {
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--primary);
  flex: none;
}

.tool-row-info { flex: 1; min-width: 0; }

.tool-row-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
}

.tool-row-desc {
  display: block;
  font-size: 0.79rem;
  line-height: 1.45;
  color: var(--ink-soft);
  margin-top: 2px;
}

.tool-row-arrow {
  color: var(--muted);
  flex: none;
  transition: color 0.15s, transform 0.15s;
}

.tool-row:hover .tool-row-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

/* Tool pages (img2pdf etc.) */
.page-tool { min-height: 100vh; display: flex; flex-direction: column; }

.tool-main {
  flex: 1;
  padding: 36px 0 56px;
}

.tool-header {
  text-align: center;
  margin-bottom: 28px;
}

.tool-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tool-sub {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-top: 6px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
}

.tool-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 34px 20px 30px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  color: var(--ink-soft);
}

.drop-zone:hover,
.drop-zone.drag-active {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 6px 18px rgba(36, 114, 242, 0.1);
}

.drop-zone:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.drop-zone > svg {
  display: block;
  margin: 0 auto 14px;
  /* The svg carries width/height attributes, so the box has to be widened here
     or the global border-box reset would shrink the glyph instead of the disc. */
  width: 68px;
  height: 68px;
  padding: 14px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
  transition: transform 0.15s;
}

.drop-zone:hover > svg,
.drop-zone.drag-active > svg { transform: translateY(-2px); }

/* The whole zone is clickable, but an obvious button-shaped affordance is what
   people look for. Decorative, so it never steals the zone's own click. */
.drop-zone::after {
  content: "Файл сонгох";
  display: inline-flex;
  margin-top: 16px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.drop-zone:hover::after,
.drop-zone.drag-active::after {
  border-color: var(--btn-hover);
  background: var(--btn-hover);
  color: #fff;
}

.drop-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.drop-hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.thumb-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.thumb-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(36, 114, 242, 0.12);
}

.thumb-item.dragging { opacity: 0.4; }
.thumb-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

.thumb-preview {
  aspect-ratio: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

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

.thumb-info {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 0.74rem;
}

.thumb-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.thumb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(23, 35, 58, 0.7);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.thumb-item:hover .thumb-remove { opacity: 1; }
.thumb-remove:hover { background: var(--danger); }

.tool-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.tool-btn-primary {
  background: var(--btn);
  color: #fff;
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  margin-top: 14px;
}

.tool-btn-primary:hover { background: var(--btn-hover); }
.tool-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.tool-btn-secondary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.tool-btn-secondary:hover { background: #d8e7fd; }

.tool-btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--border);
}

.tool-btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }

.tool-sidebar { position: sticky; top: 80px; }

.options-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.options-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Keeps the heading tied to the panel body; ::before survives textContent writes
   from the mode switcher. */
.options-title::before {
  content: "";
  flex: none;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
}

.option-group { margin-bottom: 14px; }

.option-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.option-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--card);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.option-select:focus { border-color: var(--primary); }

.options-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 12px;
}

.options-hint::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  background: currentColor;
}

/* setStatus() toggles these two classes, so a finished job and a failed one have
   to read differently at a glance instead of both being muted grey text. The
   label colors are deeper than --green/--danger: on a tinted fill those tokens
   fall under AA for small text. */
.options-hint.is-ok {
  background: var(--green-soft);
  border-color: rgba(24, 163, 90, 0.3);
  color: #0b6a3b;
}

.options-hint.is-error {
  background: var(--danger-soft);
  border-color: rgba(212, 68, 31, 0.3);
  color: #b23715;
}

@media (max-width: 780px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-sidebar { position: static; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Touch devices latch :hover after a tap, leaving cards looking pressed. */
@media (hover: none) {
  .card:hover { box-shadow: none; border-color: var(--border); }
  .pg-related-card:hover { transform: none; }
  .tool-row:hover { box-shadow: none; border-color: var(--border); }
}

@media (max-width: 640px) {
  .pm-bank { padding: 12px; }
  .pm-bank-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .pm-bank-value { letter-spacing: 0.03em; word-break: break-all; }
  .pm-copy { width: 100%; padding: 11px 14px; }
  .pm-steps { font-size: 0.86rem; }
  .pm-actions > .btn { flex: 1 1 100%; justify-content: center; }

  .pg-card { padding: 18px 16px; border-radius: 14px; }
  .pg-name { font-size: 1.3rem; }
  .pg-desc { font-size: 0.92rem; }
  .pg-long { font-size: 0.9rem; margin: 20px 0; padding-top: 18px; }
  .pg-guide-step { padding: 11px 12px 11px 42px; font-size: 0.87rem; }
  .pg-guide-step::before { left: 10px; width: 22px; height: 22px; }
  .pg-guide-blur { margin-bottom: -60px; }
  .pg-related-card { flex: 1 1 100%; }

  .dl-card { padding: 18px 16px; }
}

/* Theme toggle (public pages) */
/* Killing transitions for the swap frame stops colors animating through
   low-contrast midpoints between the two palettes. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.theme-toggle .ico-sun { display: none; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
[data-theme="dark"] .theme-toggle .ico-sun { display: block; }

/* ===================== Dark theme overrides ===================== */
/* Only for surfaces whose light colors are hardcoded above. */

[data-theme="dark"] .site-header {
  background: rgba(10, 16, 26, 0.92);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .nav-drop-menu { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); }

[data-theme="dark"] .card:hover {
  border-color: #3f567f;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

/* Program monogram tiles keep their own brand color; some are near-black. */
[data-theme="dark"] .mono { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); }

/* Logo tiles stay light so brand marks remain visible. */
[data-theme="dark"] .mono-logo { background: #eef2f7; border-color: #3a4a6b; }

[data-theme="dark"] .notfound-code { background: var(--raised); }

[data-theme="dark"] .btn-secondary { background: var(--raised); }

/* Premium payment page */
[data-theme="dark"] .page-payment .dl-main {
  background:
    radial-gradient(560px 280px at 50% -80px, rgba(245, 189, 77, 0.12), transparent 70%),
    radial-gradient(760px 340px at 88% 6%, rgba(77, 159, 255, 0.09), transparent 72%);
}

[data-theme="dark"] .pm-card {
  border-color: #3a3323;
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .pm-hero {
  background: linear-gradient(135deg, #1d1a12 0%, #251f13 45%, #302714 100%);
  border-bottom-color: #3d3421;
}

[data-theme="dark"] .pm-hero-star { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.4); }

[data-theme="dark"] .pm-hero-kicker {
  color: #ecc57e;
  background: rgba(245, 189, 77, 0.12);
  border-color: rgba(245, 189, 77, 0.3);
}

[data-theme="dark"] .pm-hero-sub { color: #c4ac7e; }

[data-theme="dark"] .pm-hero-price {
  background: #121926;
  border-color: rgba(245, 189, 77, 0.32);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .pm-hero-price span { color: #f5cf85; }
[data-theme="dark"] .pm-hero-price small { color: #b3985f; }

[data-theme="dark"] .pm-hero--done {
  background: linear-gradient(135deg, #12201a 0%, #16281e 55%, #1a3125 100%);
  border-bottom-color: #26412f;
}

[data-theme="dark"] .pm-hero--done .pm-hero-star { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.28); }

/* The dark palette's green is bright enough that white glyphs drop under 3:1. */
[data-theme="dark"] .pm-hero--done .pm-hero-star { color: #08331f; }
[data-theme="dark"] .pm-copy.is-copied { color: #08331f; }

[data-theme="dark"] .pm-hero--done .pm-hero-kicker {
  color: #7ee2a8;
  border-color: rgba(61, 220, 132, 0.32);
  background: rgba(61, 220, 132, 0.12);
}

[data-theme="dark"] .pm-hero--done .pm-hero-sub { color: #92c2a8; }

[data-theme="dark"] .pm-bank {
  background: linear-gradient(180deg, #16202f, #141d2b);
  border-color: #2b3d5c;
}

[data-theme="dark"] .pm-bank-value { background: #0e1522; border-color: #2b3d5c; }
[data-theme="dark"] .pm-copy { background: #16202f; }

[data-theme="dark"] .pm-steps li:not(:last-child)::before {
  background: linear-gradient(180deg, #2f4463, rgba(47, 68, 99, 0));
}

[data-theme="dark"] .pm-confirm {
  background: linear-gradient(180deg, #1d1a12, #191710);
  border-color: #3d3421;
  box-shadow: none;
}

[data-theme="dark"] .pm-confirm-note { color: #b8a377; }
[data-theme="dark"] .pm-ghost:hover { border-color: #3a4a6b; }

[data-theme="dark"] .auth-submit.pm-primary { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.32); }
[data-theme="dark"] .auth-submit.pm-primary:hover { box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.32); }

[data-theme="dark"] .pm-status.info { color: #a8cdff; }
[data-theme="dark"] .pm-status.pending { background: rgba(245, 189, 77, 0.14); color: #ecc57e; }

[data-theme="dark"] .pm-choice { background: #16202f; border-color: #2b3d5c; }
[data-theme="dark"] .pm-choice:hover { border-color: #3a4a6b; }

[data-theme="dark"] .pm-choice.is-on {
  background: linear-gradient(180deg, #251f13, #1d1a12);
  border-color: #8a6a25;
  box-shadow: 0 0 0 3px rgba(245, 189, 77, 0.12);
}

[data-theme="dark"] .pm-qr {
  background: linear-gradient(180deg, #1d1a12, #191710);
  border-color: #3d3421;
  box-shadow: none;
}

[data-theme="dark"] .pm-qr-lede strong { color: var(--ink); }
[data-theme="dark"] .pm-qr-amount { color: #f5cf85; }
[data-theme="dark"] .pm-qr-tip { color: #b8a377; }
[data-theme="dark"] .pm-qr-img { border-color: #5a4a28; }

/* Auth surfaces */
[data-theme="dark"] .auth-overlay { background: rgba(4, 8, 14, 0.68); }
[data-theme="dark"] .auth-modal { box-shadow: 0 26px 64px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .auth-card { box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45); }

[data-theme="dark"] .auth-tab[aria-selected="true"] {
  background: var(--raised);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .auth-tabs { background: var(--bg); }

[data-theme="dark"] .confirm-cancel { background: var(--raised); }

[data-theme="dark"] .btn-premium {
  color: #f5c463;
  background: rgba(245, 189, 77, 0.16);
}

[data-theme="dark"] .btn-premium:hover { background: rgba(245, 189, 77, 0.26); }

/* Download + program pages */
[data-theme="dark"] .dl-card,
[data-theme="dark"] .nf-card,
[data-theme="dark"] .pg-card { box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45); }

[data-theme="dark"] .pg-related-card { background: var(--bg); }

[data-theme="dark"] .pg-guide-skel span { background: #2b3548; }

[data-theme="dark"] .pg-guide.locked .pg-guide-badge { background: linear-gradient(135deg, #5b6675, #464f5c); }

[data-theme="dark"] .pg-guide-lock {
  background: linear-gradient(160deg, #251f13, #1e1a10);
  border-color: #4a3d21;
}

[data-theme="dark"] .pg-guide-lock-text { color: #d9bd85; }

/* Tool pages */
[data-theme="dark"] .tool-panel,
[data-theme="dark"] .options-card { box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); }

[data-theme="dark"] .options-hint.is-ok { color: #6ee7a8; border-color: rgba(61, 220, 132, 0.32); }
[data-theme="dark"] .options-hint.is-error { color: #ff9d85; border-color: rgba(255, 127, 99, 0.32); }

[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.drag-active { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }

[data-theme="dark"] .tool-row:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }

[data-theme="dark"] .tool-btn-secondary:hover { background: rgba(77, 159, 255, 0.22); }

[data-theme="dark"] .thumb-remove { background: rgba(4, 8, 14, 0.75); }

[data-theme="dark"] .thumb-item:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45); }

/* ============================================================
   Tools suite — PDF and image utilities
   Token-only so the dark palette swap covers these surfaces.
   ============================================================ */

.tools-panel { margin-bottom: 26px; }

.pill-group {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
}

.pill {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

.pill.is-active { background: var(--btn); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.pill.is-active:hover { color: #fff; }
.pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.option-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
}

.option-input:focus { border-color: var(--primary); }

.option-help {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 6px;
  line-height: 1.45;
}

.option-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 5px;
}

.option-notice {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  padding: 10px 12px;
}

.option-range {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--primary);
  cursor: pointer;
}

.range-value {
  float: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}

.file-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.file-summary-ico { display: flex; color: var(--primary); flex: none; }

.file-summary-name {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-summary-meta {
  font-size: 0.77rem;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.file-summary-clear {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

.file-summary-clear:hover { color: var(--danger); }

.tool-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tool-result { position: relative; display: block; cursor: pointer; }

/* The rendered page is always a light image, so a dark chip reads in both themes. */
.tool-result::after {
  content: "\2193";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: rgba(16, 24, 40, 0.68);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 700;
}

.tool-btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: border-color 0.15s, background 0.15s;
}

/* The row's reorder/remove buttons act on this row only, so pointing at a row
   has to show which one. */
.file-row:hover { border-color: var(--primary); background: var(--card); }

.file-row-num {
  flex: none;
  width: 21px;
  height: 21px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.file-row-name {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row-meta {
  flex: none;
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-row-btns { display: flex; gap: 3px; flex: none; }

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.icon-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn-danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }

.cmp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.cmp-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: border-color 0.15s;
}

.cmp-row:hover { border-color: var(--primary); }

.cmp-thumb {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--raised);
}

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

.cmp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmp-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmp-detail {
  font-size: 0.76rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Status is carried by the dot colour so the label text keeps its contrast. */
.cmp-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.cmp-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.cmp-badge.is-good::before { background: var(--green); }
.cmp-badge.is-flat::before { background: var(--gold); }
.cmp-badge.is-bad::before { background: var(--danger); }

.cmp-dl {
  flex: none;
  width: auto;
  margin-top: 0;
  padding: 8px 15px;
  font-size: 0.8rem;
  text-decoration: none;
}

.tool-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  padding-bottom: 34px;
}

.tool-note {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.tool-note-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 12px;
  flex: none;
}

.tool-note-title { font-size: 0.94rem; font-weight: 800; margin-bottom: 7px; }

.tool-note p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

@media (max-width: 620px) {
  .file-row, .cmp-row { flex-wrap: wrap; }
  .file-row-meta { width: 100%; order: 5; padding-left: 31px; }
  .cmp-detail { white-space: normal; }
  .tool-result-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .pill-group { width: 100%; }
  .pill { flex: 1; }
  .drop-zone { padding: 26px 14px 24px; }
  .drop-zone > svg { width: 58px; height: 58px; padding: 11px; border-radius: 15px; }
  .tool-chips { gap: 6px; }
  .tool-chip { font-size: 0.74rem; padding: 5px 10px; }
}

/* Hub directory rows sit inside a white panel, so they take the inset fill;
   every other part of the row comes from the shared .tool-row rules. The panel
   has no heading, so the list's top margin would just be dead space. */
.tools-panel .tool-row { background: var(--bg-soft); }
.tools-panel .tools-list { margin-top: 0; }

/* Header kicker plus the privacy claim stated up front. */
.tool-eyebrow {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.tool-chip svg { color: var(--primary); flex: none; }

