/* okcomer - "Greenmarket" design system. Light + dark via prefers-color-scheme;
   kitchen mode is always dark. No external assets (CSP default-src 'self'). */

:root {
  --bg: #f6f4ec;
  --surface: #ffffff;
  --surface-2: #fbfbf7;
  --ink: #23302a;
  --ink-2: #4b5a51;
  --muted: #6b7b72;
  --faint: #93a199;
  --placeholder: #a6b0a8;
  --green: #3f8f5b;
  --green-deep: #2f6f46;
  --green-tint: #e6f0e6;
  --green-tint-2: #e3f1e6;
  --citrus: #e8873a;
  --citrus-deep: #b5651d;
  --citrus-tint: #fbe9d8;
  --lemon: #f2c94c;
  --lemon-tint: #f6efce;
  --lemon-deep: #7a5c1f;
  --line: #dcdccf;
  --line-card: #e8e8dc;
  --line-soft: #eaeade;
  --danger: #b04a2f;
  --danger-tint: #fbeeea;

  --radius-card: 20px;
  --radius-card-sm: 18px;
  --radius-input: 12px;
  --radius-btn: 15px;
  --shadow-card: 0 6px 16px -12px rgba(35, 48, 42, 0.5);
  --shadow-btn: 0 10px 20px -10px rgba(63, 143, 91, 0.8);

  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 15.5px;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}

a {
  color: var(--green-deep);
}

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

/* --- Layout / shell ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line-card);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.05;
}

.brand-tagline {
  display: block;
  font-weight: 600;
  font-size: 10.5px;
  font-style: italic;
  color: #7d9a86;
}

nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}

nav::-webkit-scrollbar {
  display: none;
}

nav a {
  flex: none;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

nav a.add {
  background: var(--citrus-tint);
  border-color: transparent;
  color: var(--citrus-deep);
}

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

.nav-logout-form {
  flex: none;
  margin: 0;
}

button.nav-logout {
  flex: none;
  min-height: 0;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

/* Hamburger toggle: hidden on wide screens, shown when the nav would overflow. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-left: auto;
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.nav-toggle:focus-visible {
  border-color: var(--green);
}

/* Narrow screens: collapse the nav pills behind the hamburger. */
@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
  }
  nav {
    display: none;
    order: 3;
    flex: 0 0 100%;
    flex-direction: column;
    gap: 0.35rem;
    overflow: visible;
    margin-top: 0.5rem;
  }
  nav.nav--open {
    display: flex;
  }
  nav a,
  button.nav-logout {
    width: 100%;
  }
  .nav-logout-form {
    width: 100%;
  }
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.flash {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.flash li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  background: var(--green-tint-2);
  border: 1px solid #cbe6d1;
  border-radius: var(--radius-input);
  color: var(--green-deep);
  font-weight: 600;
  font-size: 13.5px;
}

.flash li span {
  flex: 1;
}

button.flash-x {
  min-height: 0;
  padding: 0.2rem;
  background: transparent;
  color: inherit;
  border: 0;
  box-shadow: none;
}

/* --- Cards, controls ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1rem;
  margin-bottom: 0.85rem;
}

label {
  display: block;
  margin: 0.6rem 0 0.25rem;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-2);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
}

textarea {
  resize: vertical;
}

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

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2rem;
  /* Inline chevron (data: URI is allowed under img-src 'self' data:). */
  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='%239aa89f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.7rem 1.1rem;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--green);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
}

.button.secondary,
button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.citrus,
button.citrus {
  background: var(--citrus-tint);
  color: var(--citrus-deep);
  box-shadow: none;
}

.button.danger,
button.danger {
  background: var(--danger-tint);
  color: var(--danger);
  box-shadow: none;
}

.button.block,
button.block {
  width: 100%;
}

.button-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.button-row > * {
  flex: 1;
}

.eyebrow {
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  color: var(--green);
  text-transform: uppercase;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 0.4rem;
}

/* Striped photo placeholder (empty state). */
.thumb {
  flex: none;
  border-radius: 15px;
  background: repeating-linear-gradient(
    -45deg,
    var(--green-tint),
    var(--green-tint) 6px,
    var(--surface-2) 6px,
    var(--surface-2) 12px
  );
}

/* --- Tags / chips --------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--green-tint);
  color: var(--green-deep);
}

.tag.protein {
  background: var(--citrus-tint);
  color: var(--citrus-deep);
}

.tag.veg {
  background: var(--lemon-tint);
  color: var(--lemon-deep);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 12px;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--green-tint-2);
  color: var(--green-deep);
}

.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
}

/* --- Recipe form ---------------------------------------------------------- */

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 0.75rem;
}

.ingredient-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.ingredient-row input {
  min-width: 0;
}

.ingredient-row .ing-qty {
  flex: 0 1 3.4rem;
  text-align: center;
}

.ingredient-row .ing-unit {
  flex: 0 1 4.2rem;
}

.ingredient-row .ing-name {
  flex: 4 1 9rem;
}

.step-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.step-row .step-no {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 0.35rem;
  border-radius: 8px;
  background: var(--green-tint);
  color: var(--green-deep);
  font-weight: 800;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-row textarea {
  flex: 1;
}

.add-row {
  width: 100%;
  min-height: 0;
  margin-top: 0.1rem;
  padding: 0.55rem;
  border: 1px dashed #b7c6b4;
  border-radius: var(--radius-input);
  background: #eef4ea;
  color: var(--green-deep);
  font-weight: 700;
  font-size: 13px;
  box-shadow: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

/* Scan panel + banners. */
.scan-panel {
  text-align: center;
  padding: 1.5rem 1rem;
  border: 2px dashed #c6d4c3;
  border-radius: var(--radius-card);
  background: #eef4ea;
}

.scan-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 0.5rem;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-label {
  display: inline-block;
  cursor: pointer;
}

.file-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.banner {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-input);
  background: var(--citrus-tint);
  color: var(--citrus-deep);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.recipe-photo {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-card-sm);
  margin: 0.5rem 0 1rem;
}

.photo-preview {
  width: 88px;
  height: 88px;
  border-radius: 16px;
  object-fit: cover;
}

/* --- Filter bar (library + catalog) -------------------------------------- */

.filters {
  padding: 0.85rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* --- Plan / dinner cards -------------------------------------------------- */

.dinner-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dinner {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem;
}

.dinner .thumb {
  width: 54px;
  height: 54px;
}

.dinner .title {
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}

.plan-note {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 0.5rem;
}

/* --- Recipe list / detail ------------------------------------------------- */

.recipe-card {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem;
}

a.recipe-card {
  text-decoration: none;
  color: inherit;
}

.recipe-card .thumb {
  width: 48px;
  height: 48px;
}

.recipe-card .title {
  font-weight: 800;
  font-size: 14.5px;
}

/* --- Settings reader ordering -------------------------------------------- */

.reader-list {
  padding-left: 1.2rem;
}

.reader-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.reader-row label {
  margin: 0;
  flex: 1;
  font-size: 14px;
}

.reader-row input[type="checkbox"] {
  width: auto;
}

.reader-row input[type="number"] {
  width: 5rem;
}

#step-rows textarea {
  margin-bottom: 0.5rem;
}

/* --- Bulk upload queue ---------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
}

table.queue {
  width: 100%;
  border-collapse: collapse;
}

table.queue th,
table.queue td {
  text-align: left;
  padding: 0.55rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  /* Wrap long titles, unspaced strings, and reader-error text inside the cell
     so a long recipe never stretches the table past its container. The short
     Status/Action columns size to content; the Card column takes the rest. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.queue-actions form {
  margin: 0;
}

.queue-actions .button,
.queue-actions button {
  min-height: 0;
  padding: 0.4rem 0.7rem;
  font-size: 12.5px;
  box-shadow: none;
}

.status {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #ececdf;
  color: #6a6a6a;
  white-space: nowrap;
}

.status-saved {
  background: #e3f1e6;
  color: #2f6f46;
}

.status-ready {
  background: #e6f0e6;
  color: #2f6f46;
}

.status-processing {
  background: #fbe9d8;
  color: #8a5a24;
}

.status-queued {
  background: #ececdf;
  color: #6a6a6a;
}

.status-failed {
  background: #fbeeea;
  color: #b04a2f;
}

/* --- Kitchen mode (always dark) ------------------------------------------- */

.kitchen {
  --k-bg: #14201a;
  --k-surface: #22332a;
  --k-border: #35473b;
  --k-ink: #eef3ec;
  --k-muted: #b7ccbd;
  --k-green: #6fd08a;
  --k-green-strong: #3fbf6b;
  --k-dot-off: #2c3d33;
  background: var(--k-bg);
  color: var(--k-ink);
  min-height: 100vh;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.kitchen a,
.kitchen .muted {
  color: var(--k-muted);
}

.kitchen-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.kitchen .button.secondary {
  background: var(--k-surface);
  color: var(--k-ink);
  border-color: var(--k-border);
  box-shadow: none;
}

.kitchen-close {
  min-height: 0;
  padding: 0.45rem;
  border-radius: 999px;
}

.kitchen summary {
  cursor: pointer;
  font-weight: 700;
}

.kitchen ul {
  color: var(--k-muted);
}

.kitchen-eyebrow {
  color: var(--k-green);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.cook-counter {
  color: var(--k-green);
  font-weight: 700;
  font-size: 13px;
  margin: 1rem 0 0.5rem;
}

.cook-step {
  font-size: 29px;
  font-weight: 700;
  line-height: 1.3;
  min-height: 6rem;
}

.kitchen details {
  margin: 1rem 0;
  background: var(--k-surface);
  border: 1px solid var(--k-border);
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
}

.cook-progress {
  display: flex;
  gap: 6px;
  margin: 1.25rem 0;
}

.cook-progress span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--k-dot-off);
}

.cook-progress span.on {
  background: var(--k-green);
}

.cook-controls {
  display: flex;
  gap: 0.75rem;
}

.cook-controls button {
  min-height: 60px;
  font-size: 1.2rem;
  border-radius: 20px;
  box-shadow: none;
}

#cook-prev {
  flex: none;
  width: 88px;
  background: transparent;
  color: var(--k-ink);
  border: 1px solid var(--k-border);
}

#cook-next {
  flex: 1;
  background: var(--k-green-strong);
  color: #12201a;
}

#cook-prev:disabled,
#cook-next:disabled {
  opacity: 0.45;
}

/* --- Responsive ----------------------------------------------------------- */

@media (min-width: 720px) {
  main {
    padding: 1.75rem 1.5rem 3rem;
  }

  .field-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Dark mode (site-wide; kitchen stays dark regardless) ----------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14201a;
    --surface: #1e2c25;
    --surface-2: #24332b;
    --ink: #eef3ec;
    --ink-2: #c4d4c9;
    --muted: #9db0a4;
    --faint: #7e9186;
    --placeholder: #7e9186;
    --green: #6fd08a;
    --green-deep: #9fe0b1;
    --green-tint: #24382c;
    --green-tint-2: #24382c;
    --citrus: #eaa065;
    --citrus-deep: #f0b184;
    --citrus-tint: #3a2c1f;
    --lemon-tint: #33301c;
    --lemon-deep: #e6d59a;
    --line: #35473b;
    --line-card: #2c3d33;
    --line-soft: #2c3d33;
    --danger: #e79079;
    --danger-tint: #3a241d;
    --shadow-card: 0 6px 16px -12px rgba(0, 0, 0, 0.6);
    --shadow-btn: 0 10px 20px -12px rgba(0, 0, 0, 0.7);
  }

  button,
  .button {
    color: #12201a;
  }

  .button.secondary,
  button.secondary {
    color: var(--ink);
  }

  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='%239db0a4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}

/* Market illustration kit ("Greenmarket" spot art) --------------------------- */
@keyframes okc-shake-l {
  0%, 100% { transform: rotate(-13deg); }
  50% { transform: rotate(-24deg); }
}
@keyframes okc-shake-r {
  0%, 100% { transform: rotate(13deg); }
  50% { transform: rotate(24deg); }
}
@keyframes okc-fall {
  0% { opacity: 0; transform: translateY(-6px); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(16px); }
}
@keyframes okc-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.okc-bob { animation: okc-bob 4s ease-in-out infinite; }
.okc-bob-2 { animation: okc-bob 3.4s ease-in-out infinite; }
.okc-bob-3 { animation: okc-bob 3.8s ease-in-out infinite; }
.okc-shake-l {
  transform-box: view-box;
  transform-origin: 34px 78px;
  animation: okc-shake-l 1.1s ease-in-out infinite;
}
.okc-shake-r {
  transform-box: view-box;
  transform-origin: 66px 78px;
  animation: okc-shake-r 1.1s ease-in-out infinite;
}
.okc-fall { animation: okc-fall 1.1s ease-in infinite; }
.okc-fall-d3 { animation: okc-fall 1.1s ease-in infinite 0.3s; }
.okc-fall-d5 { animation: okc-fall 1.1s ease-in infinite 0.5s; }

/* Centered empty / waiting states with a spot illustration. */
.empty-state {
  text-align: center;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-state h2,
.empty-state h3 {
  margin: 4px 0 0;
}
.empty-state .empty-art {
  display: flex;
  gap: 4px;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Accessible help markers: a small "?" that reveals a usage hint on hover,
   keyboard focus, or tap (.help--open, toggled by tooltips.js for touch). The
   bubble is a fixed dark chip so it stays legible over light and dark grounds. */
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 16px;
  height: 16px;
  min-width: 0;
  min-height: 0;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
}
.help:hover,
.help:focus-visible {
  color: var(--green-deep);
  border-color: var(--green);
}
.help::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(260px, 70vw);
  padding: 8px 11px;
  border-radius: 10px;
  background: #23302a;
  color: #fff;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
  pointer-events: none;
  z-index: 60;
}
.help::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #23302a;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 60;
}
.help:hover::after,
.help:focus-visible::after,
.help.help--open::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.help:hover::before,
.help:focus-visible::before,
.help.help--open::before {
  opacity: 1;
  visibility: visible;
}
/* "How this works" explainer dialog + its small opener button. */
.how-open-btn {
  flex: none;
  min-height: 0;
  padding: 0.35rem 0.75rem;
  font-size: 12px;
}
.how-dialog {
  max-width: 520px;
  width: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5);
}
.how-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.how-body {
  padding: 1.25rem 1.4rem;
}
.how-body h2 {
  margin-top: 0;
}
.how-steps {
  margin: 0.5rem 0 1rem;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.how-steps li {
  line-height: 1.45;
}

/* Anchor a help marker to the right edge of a full-width action/button. */
.has-tip {
  position: relative;
}
.has-tip > .help {
  position: absolute;
  top: 50%;
  right: 12px;
  margin: 0;
  transform: translateY(-50%);
}
