/* ── AMBIENT ── */
.rsl-ambient {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; overflow: hidden;
}
.rsl-ambient::before {
  content: '';
  position: absolute; top: -20%; left: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0,238,252,0.07) 0%, transparent 70%);
  border-radius: 50%;
  animation: rslDrift1 20s ease-in-out infinite alternate;
}
.rsl-ambient::after {
  content: '';
  position: absolute; bottom: -20%; right: -10%;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(34,197,94,0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: rslDrift2 25s ease-in-out infinite alternate;
}
@keyframes rslDrift1 { from { transform: translate(0,0); } to { transform: translate(60px,80px); } }
@keyframes rslDrift2 { from { transform: translate(0,0); } to { transform: translate(-80px,-60px); } }

/* ── LAYOUT ── */
.rsl-wrap {
  position: relative; z-index: 1;
  max-width: 880px; margin: 0 auto;
  padding: 120px 1.5rem 5rem;
}

/* ── HERO ── */
.rsl-hero { margin-bottom: 2.5rem; text-align: center; }
.rsl-hero .page-title { margin-bottom: 1rem; }
.rsl-desc {
  font-size: 0.92rem; line-height: 1.65;
  color: var(--on-surface-variant);
  max-width: 620px; margin: 0 auto;
}

/* Visually hidden but readable by screen readers. Deliberately prefixed —
   a bare .sr-only is used across this repo but defined in no stylesheet. */
.rsl-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ── CARD ── */
.rsl-card {
  background: rgba(28,28,35,0.7);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(0,238,252,0.2);
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 0 40px rgba(0,238,252,0.06), inset 0 0 30px rgba(0,238,252,0.02);
  margin-bottom: 1.5rem;
}

/* ── TEXTAREA ── */
.rsl-textarea {
  width: 100%;
  background: rgba(14,14,19,0.7);
  border: 1px solid rgba(0,238,252,0.3);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem; font-weight: 500;
  color: var(--on-surface);
  resize: vertical; min-height: 220px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.6;
  box-sizing: border-box;
}
.rsl-textarea::placeholder { color: rgba(172,170,177,0.45); }
.rsl-textarea:focus {
  border-color: rgba(0,238,252,0.7);
  box-shadow: 0 0 16px rgba(0,238,252,0.12);
}

.rsl-meta-row { display: flex; justify-content: flex-end; margin-top: 0.4rem; }
.rsl-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem; color: var(--on-surface-variant); opacity: 0.7;
}
.rsl-count.warn { color: #f59e0b; opacity: 1; }

/* ── GENERATE BUTTON ── */
.rsl-generate-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; margin-top: 1.25rem;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, #00EEFC, #22c55e);
  color: #0a0a0f;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em;
  border: none; border-radius: 0.625rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 20px rgba(0,238,252,0.25);
}
.rsl-generate-btn:hover:not(:disabled) {
  opacity: 0.92; transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(0,238,252,0.4);
}
.rsl-generate-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.rsl-generate-btn .material-symbols-outlined { font-size: 1rem; }

/* ── STATUS ── */
.rsl-status {
  margin: 0.9rem 0 0; min-height: 1.1rem;
  font-size: 0.78rem; line-height: 1.5;
  color: var(--on-surface-variant); text-align: center;
}
.rsl-status.error { color: #f87171; }
.rsl-status a { color: #00EEFC; }

/* ── OUTPUT CARD ── */
.rsl-output-card {
  background: rgba(28,28,35,0.7);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(34,197,94,0.22);
  border-radius: 1.25rem;
  padding: 1.75rem 2rem 2rem;
  margin-bottom: 1.5rem;
  animation: rslFadeIn 0.35s ease;
}
@keyframes rslFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.rsl-output-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(248,245,253,0.08);
}
.rsl-output-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--on-surface); margin: 0;
}
.rsl-output-actions { display: flex; align-items: center; gap: 0.75rem; }
.rsl-progress {
  font-size: 0.72rem; font-weight: 600;
  color: var(--on-surface-variant);
  font-variant-numeric: tabular-nums;
}
.rsl-action-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  background: rgba(0,238,252,0.1);
  border: 1px solid rgba(0,238,252,0.3);
  border-radius: 0.5rem;
  color: #00EEFC;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem; font-weight: 700;
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.rsl-action-btn:hover { background: rgba(0,238,252,0.18); }
.rsl-action-btn.copied { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.5); color: #22c55e; }
.rsl-action-btn .material-symbols-outlined { font-size: 0.95rem; }

.rsl-summary {
  margin: 0.9rem 0 0;
  font-size: 0.8rem; color: var(--on-surface-variant);
}

/* ── CONTROLS ── */
.rsl-controls {
  display: flex; flex-direction: column; gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 1.1rem 0 0;
  border-top: 1px solid rgba(248,245,253,0.06);
}
.rsl-control-row { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.rsl-control-label {
  display: block;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(248,245,253,0.45);
  margin-bottom: 0.5rem;
}
.rsl-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.rsl-pill {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 0.42rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(248,245,253,0.18);
  border-radius: 0.5rem;
  color: var(--on-surface-variant);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1.25;
}
.rsl-pill:hover:not(.active) { border-color: rgba(0,238,252,0.5); color: var(--on-surface); }
.rsl-pill.active { font-weight: 800; }
.rsl-pill-sub { font-size: 0.6rem; font-weight: 500; opacity: 0.85; }

.rsl-mode-note {
  margin: 0.5rem 0 0;
  font-size: 0.7rem; color: rgba(172,170,177,0.75);
}

.rsl-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.76rem; color: var(--on-surface-variant); cursor: pointer;
}
.rsl-toggle input { accent-color: #00EEFC; width: 1rem; height: 1rem; cursor: pointer; }

.rsl-servings { display: flex; align-items: center; gap: 0.5rem; }
.rsl-servings input {
  width: 4rem; padding: 0.35rem 0.5rem;
  background: rgba(14,14,19,0.7);
  border: 1px solid rgba(0,238,252,0.3);
  border-radius: 0.4rem;
  color: var(--on-surface);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem; font-weight: 600;
  outline: none;
}
.rsl-servings input:focus { border-color: rgba(0,238,252,0.7); }
.rsl-servings-base { font-size: 0.68rem; color: rgba(172,170,177,0.7); }

.rsl-caveat {
  margin: 0.9rem 0 0; padding: 0.6rem 0.8rem;
  background: rgba(245,158,11,0.08);
  border-left: 2px solid rgba(245,158,11,0.5);
  border-radius: 0.3rem;
  font-size: 0.74rem; line-height: 1.5;
  color: rgba(248,245,253,0.8);
}

/* ── LIST ── */
.rsl-output-body { margin-top: 0.5rem; }
/* .rsl-shop-link-text carries no styling — it exists so the JS can rewrite the
   label text on retailer switch without touching the icon beside it. */
.rsl-aisle { margin-top: 1.5rem; }
.rsl-aisle.empty { display: none; }
.rsl-aisle-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.68rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: #22c55e;
  margin: 0 0 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(34,197,94,0.15);
}

.rsl-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(248,245,253,0.04);
}
.rsl-item.hidden-staple { display: none; }
.rsl-item.staple:not(.hidden-staple) { opacity: 0.62; }

.rsl-check {
  width: 1.1rem; height: 1.1rem;
  accent-color: #22c55e; cursor: pointer; flex-shrink: 0;
}

.rsl-item-main { display: flex; flex-direction: column; gap: 0.1rem; cursor: pointer; min-width: 0; }
.rsl-item-name {
  font-size: 0.87rem; font-weight: 600; color: var(--on-surface);
  line-height: 1.35;
}
.rsl-item-qty {
  font-size: 0.75rem; font-weight: 600; color: #00EEFC;
  font-variant-numeric: tabular-nums;
}
.rsl-item-qty:empty { display: none; }
.rsl-item-meta { font-size: 0.7rem; color: var(--on-surface-variant); line-height: 1.4; }
.rsl-item-meta:empty { display: none; }
.rsl-item-term { font-size: 0.66rem; color: rgba(172,170,177,0.55); font-style: italic; }

.rsl-item.ticked .rsl-item-name { text-decoration: line-through; }
.rsl-item.ticked { opacity: 0.4; }

.rsl-shop-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.7rem;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 0.5rem;
  color: #22c55e;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem; font-weight: 700;
  text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.rsl-shop-link:hover { background: rgba(34,197,94,0.2); border-color: rgba(34,197,94,0.6); }
.rsl-shop-link .material-symbols-outlined { font-size: 0.85rem; }

.rsl-unmatched {
  margin: 1.25rem 0 0;
  font-size: 0.72rem; line-height: 1.5;
  color: rgba(172,170,177,0.65);
}

/* ── EXPLAINER ── */
.rsl-explainer {
  display: flex; gap: 0.85rem;
  background: rgba(28,28,35,0.5);
  border: 1px solid rgba(248,245,253,0.08);
  border-radius: 0.9rem;
  padding: 1.1rem 1.25rem;
}
.rsl-explainer .material-symbols-outlined { color: #00EEFC; font-size: 1.2rem; flex-shrink: 0; }
.rsl-explainer-text { font-size: 0.78rem; line-height: 1.6; color: var(--on-surface-variant); }
.rsl-explainer-text strong { color: var(--on-surface); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .rsl-wrap { padding: 100px 1rem 4rem; }
  .rsl-card, .rsl-output-card { padding: 1.25rem; border-radius: 1rem; }
  .rsl-output-header { align-items: flex-start; }
}

@media (max-width: 480px) {
  /* Stack the shop link under the ingredient rather than squashing it away */
  .rsl-item { grid-template-columns: auto 1fr; row-gap: 0.5rem; }
  .rsl-shop-link { grid-column: 2; justify-self: start; }
}

/* ── PRINT ── */
@media print {
  .rsl-ambient, #header-placeholder, #footer-placeholder, #share-bar-placeholder,
  #back-to-top, .tool-info, .rsl-card, .rsl-explainer, .rsl-controls,
  .rsl-caveat, .rsl-output-actions, .rsl-shop-link, .rsl-item-term, .rsl-status {
    display: none !important;
  }
  body { background: #fff !important; color: #000 !important; }
  .rsl-wrap { padding: 0; max-width: none; }
  .rsl-output-card {
    display: block !important;
    background: none; border: none; box-shadow: none;
    padding: 0; animation: none;
  }
  .rsl-output-header h2, .rsl-summary, .rsl-item-name, .rsl-item-meta, .rsl-aisle-title {
    color: #000 !important;
  }
  .rsl-item-qty { color: #444 !important; }
  .rsl-aisle-title { border-bottom: 1px solid #000; }
  .rsl-item { border-bottom: 1px solid #ddd; break-inside: avoid; }
  .rsl-item.ticked { opacity: 1; }
  /* Render the checkbox as an empty square you can tick with a pen */
  .rsl-check { appearance: none; -webkit-appearance: none; border: 1px solid #000; background: #fff; }
}
