/* ===================================================================
   RECETAS — Premium Food App v11
   Vibe: Editorial food magazine · Photo-forward · High contrast
   =================================================================== */

/* === DESIGN TOKENS === */
:root {
  color-scheme: light;
  --bg:            #f2f0ec;
  --bg-2:          #e6e4df;
  --surface:       #ffffff;
  --surface-2:     #f8f7f5;
  --ink:           #0e0e0d;
  --ink-2:         #404040;
  --ink-3:         #8c8c8a;
  --border:        rgba(14, 14, 13, 0.08);
  --border-strong: rgba(14, 14, 13, 0.14);

  --crimson:       #e8480a;
  --crimson-dark:  #c93c08;
  --crimson-muted: rgba(232, 72, 10, 0.10);
  --crimson-tint:  #fff4f0;

  --gold:          #b89400;
  --gold-muted:    rgba(184, 148, 0, 0.12);

  --macro-p:       #1a6e4a;
  --macro-p-muted: rgba(26, 110, 74, 0.10);
  --macro-c:       #1e55b4;
  --macro-c-muted: rgba(30, 85, 180, 0.10);
  --macro-f:       #8a5800;
  --macro-f-muted: rgba(138, 88, 0, 0.10);

  --header-bg: #0d0d0d;
  --header-fg: #f2f2f0;

  --r-xs:  4px;
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-2xl: 40px;
  --r-card: 18px;

  --shadow-xs:     0 1px 2px rgba(14,14,13,0.06);
  --shadow-sm:     0 2px 8px rgba(14,14,13,0.08);
  --shadow-md:     0 6px 24px rgba(14,14,13,0.10), 0 2px 6px rgba(14,14,13,0.05);
  --shadow-lg:     0 16px 48px rgba(14,14,13,0.12), 0 4px 12px rgba(14,14,13,0.06);
  --shadow-xl:     0 28px 72px rgba(14,14,13,0.14), 0 8px 24px rgba(14,14,13,0.08);
  --shadow-crimson: 0 4px 20px rgba(232, 72, 10, 0.30), 0 2px 6px rgba(232, 72, 10, 0.14);

  --font-display:   'Outfit', system-ui, -apple-system, sans-serif;
  --font-editorial: 'Playfair Display', 'Georgia', serif;
  --font-body:      'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono:      'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out:   cubic-bezier(0.65, 0, 0.35, 1);

  --t-fast:   130ms var(--ease-out);
  --t-base:   260ms var(--ease-out);
  --t-slow:   480ms var(--ease-out);
  --t-spring: 500ms var(--ease-spring);

  /* Emil: stronger custom easing — never use browser defaults for UI interactions */
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer:     cubic-bezier(0.32, 0.72, 0, 1);
}

/* === DARK MODE === */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #111111;
    --bg-2:          #1a1a1a;
    --surface:       #1e1e1e;
    --surface-2:     #242424;
    --ink:           #f0ede8;
    --ink-2:         #9a9a98;
    --ink-3:         #606060;
    --border:        rgba(240, 237, 232, 0.09);
    --border-strong: rgba(240, 237, 232, 0.16);
    --crimson:       #ff5a20;
    --crimson-dark:  #e04a14;
    --crimson-muted: rgba(255, 90, 32, 0.15);
    --crimson-tint:  #1f0d06;
    --gold:          #e0b000;
    --gold-muted:    rgba(224, 176, 0, 0.15);
    --macro-p:       #3abf78;
    --macro-p-muted: rgba(58, 191, 120, 0.12);
    --macro-c:       #5890e8;
    --macro-c-muted: rgba(88, 144, 232, 0.12);
    --macro-f:       #d09040;
    --macro-f-muted: rgba(208, 144, 64, 0.12);
    --header-bg: #080808;
    --header-fg: #f0ede8;
    --shadow-xs:     0 1px 2px rgba(0,0,0,0.25);
    --shadow-sm:     0 1px 4px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.18);
    --shadow-md:     0 4px 16px rgba(0,0,0,0.32), 0 2px 6px rgba(0,0,0,0.20);
    --shadow-lg:     0 12px 40px rgba(0,0,0,0.38), 0 4px 12px rgba(0,0,0,0.24);
    --shadow-xl:     0 24px 60px rgba(0,0,0,0.45), 0 8px 20px rgba(0,0,0,0.28);
    --shadow-crimson: 0 4px 20px rgba(255, 90, 32, 0.35), 0 2px 6px rgba(255, 90, 32, 0.20);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:            #111111;
  --bg-2:          #1a1a1a;
  --surface:       #1e1e1e;
  --surface-2:     #242424;
  --ink:           #f0ede8;
  --ink-2:         #9a9a98;
  --ink-3:         #606060;
  --border:        rgba(240, 237, 232, 0.09);
  --border-strong: rgba(240, 237, 232, 0.16);
  --crimson:       #ff5a20;
  --crimson-dark:  #e04a14;
  --crimson-muted: rgba(255, 90, 32, 0.15);
  --crimson-tint:  #1f0d06;
  --gold:          #e0b000;
  --gold-muted:    rgba(224, 176, 0, 0.15);
  --macro-p:       #3abf78;
  --macro-p-muted: rgba(58, 191, 120, 0.12);
  --macro-c:       #5890e8;
  --macro-c-muted: rgba(88, 144, 232, 0.12);
  --macro-f:       #d09040;
  --macro-f-muted: rgba(208, 144, 64, 0.12);
  --header-bg: #080808;
  --header-fg: #f0ede8;
  --shadow-xs:     0 1px 2px rgba(0,0,0,0.25);
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.18);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.32), 0 2px 6px rgba(0,0,0,0.20);
  --shadow-lg:     0 12px 40px rgba(0,0,0,0.38), 0 4px 12px rgba(0,0,0,0.24);
  --shadow-xl:     0 24px 60px rgba(0,0,0,0.45), 0 8px 20px rgba(0,0,0,0.28);
  --shadow-crimson: 0 4px 20px rgba(255, 90, 32, 0.35), 0 2px 6px rgba(255, 90, 32, 0.20);
  color-scheme: dark;
}

/* === KEYFRAMES === */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.92); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  to   { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.95); }
}

@keyframes heroLine {
  from { opacity: 0; transform: translateY(22px); filter: blur(3px); }
  to   { opacity: 1; transform: translateY(0);    filter: blur(0); }
}

@keyframes underlineReveal {
  from { clip-path: inset(0 100% 0 0); opacity: 0; }
  to   { clip-path: inset(0 0%   0 0); opacity: 0.7; }
}

@keyframes dotPulse {
  0%   { transform: scale(1.15); }
  45%  { transform: scale(1.55); }
  75%  { transform: scale(1.25); }
  100% { transform: scale(1.3);  }
}

@keyframes btnSweep {
  0%   { left: -60%; opacity: 0; }
  15%  { opacity: 1; }
  50%  { left: 160%; opacity: 0; }
  100% { left: 160%; opacity: 0; }
}

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.88); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes slideDown {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(32px); opacity: 0; }
}

@keyframes cardOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to   { opacity: 0; transform: scale(0.92) translateY(-8px); }
}


/* === RESET & BASE === */

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  touch-action: manipulation;
}

/* === FOCUS VISIBILITY === */
:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
  border-radius: 4px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none; /* inputs use crimson border + shadow on :focus */
}

/* === VISUALLY HIDDEN (for sr-only labels) === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

input, textarea {
  font-family: var(--font-body);
  color: var(--ink);
}

.hidden { display: none !important; }

/* === HEADER === */

header {
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 200;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}


.wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--header-fg);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark-icon {
  width: 22px;
  height: 22px;
  color: var(--crimson);
  flex-shrink: 0;
  border-radius: 5px;
  object-fit: cover;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

#user-email {
  font-size: 0.78rem;
  color: rgba(240, 237, 232, 0.5);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── THEME PICKER ────────────────────────────────────────────── */
.btn-theme {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(240, 237, 232, 0.55);
  transition: color var(--t-fast), transform 160ms var(--ease-spring);
}
.btn-theme:hover  { color: var(--header-fg); }
.btn-theme:active { transform: scale(0.88); }

.theme-anchor { position: relative; margin-left: auto; }

.theme-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: var(--shadow-xl);
  z-index: 200;
  width: 224px;
  animation: scaleIn .2s var(--ease-spring) both;
  transform-origin: top right;
}
.theme-panel[hidden] { display: none; }
.theme-panel.closing {
  display: block !important;
  animation: scaleOut 160ms var(--ease-in-out) both;
  pointer-events: none;
}
.theme-panel-title {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.theme-swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.swatch-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 160ms var(--ease-spring);
}
.swatch-btn:hover { background: var(--bg-2); border-color: var(--border-strong); }
.swatch-btn:active { transform: scale(0.93); }
.swatch-btn.active { border-color: var(--swatch-accent, var(--crimson)); color: var(--ink); }
.swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--swatch-accent) 50%, var(--swatch-bg,#fff) 50%);
  border: 1.5px solid rgba(0,0,0,.1);
}
.theme-divider {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 4px 2px 2px;
  grid-column: 1 / -1;
  opacity: .7;
}

#btn-logout {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(240, 237, 232, 0.6);
  padding: 5px 12px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(240, 237, 232, 0.15);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

#btn-logout:hover {
  background: rgba(240, 237, 232, 0.08);
  color: var(--header-fg);
  border-color: rgba(240, 237, 232, 0.3);
}
#btn-logout:active { transform: scale(0.95); }

/* === AUTH MODAL === */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 500;
  animation: fadeUp 350ms var(--ease-out) both;
}

.auth-box {
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-2xl);
  padding: 4px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 400px;
  animation: scaleIn 400ms var(--ease-spring) both;
}

.auth-box-inner {
  background: var(--surface);
  border-radius: calc(var(--r-2xl) - 4px);
  padding: 36px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: -4px;
}

.auth-brand-leaf {
  width: 28px;
  height: 28px;
  color: var(--crimson);
  border-radius: 7px;
  object-fit: cover;
}

.auth-tagline {
  font-size: 0.84rem;
  color: var(--ink-3);
  margin-top: -12px;
}

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-2);
  border-radius: var(--r-lg);
  padding: 3px;
}

.auth-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: calc(var(--r-lg) - 3px);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-3);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.auth-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.auth-error {
  font-size: 0.82rem;
  color: var(--crimson);
  min-height: 1em;
  margin-top: -8px;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field-group input {
  background: var(--bg-2);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.field-group input::placeholder { color: var(--ink-3); }

.field-group input:-webkit-autofill,
.field-group input:-webkit-autofill:hover,
.field-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0px 1000px var(--bg-2) inset;
  transition: background-color 5000s ease-in-out 0s;
}

.field-group input:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted);
}

#auth-submit {
  width: 100%;
  background: var(--crimson);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--r-xl);
  padding: 12px 20px;
  box-shadow: var(--shadow-crimson);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

#auth-submit:hover {
  background: var(--crimson-dark);
  box-shadow: 0 6px 28px rgba(232, 72, 10, 0.35);
}

#auth-submit:active { transform: scale(0.97); }
#auth-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* === MAIN LAYOUT === */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

/* === EXTRACT SECTION — HERO STYLE === */

.extract-section {
  padding: 72px 0 68px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 64px;
  background:
    radial-gradient(ellipse 65% 55% at -5% -10%, rgba(232, 72, 10, 0.20) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 105% 110%, rgba(232, 72, 10, 0.07) 0%, transparent 70%);
}

.extract-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--crimson);
  background: var(--crimson-tint);
  border: 1px solid var(--crimson-muted);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 18px;
  animation: heroLine 550ms var(--ease-out) 0ms both;
}

.extract-heading {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 9vw, 5.5rem);
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1.0;
  text-wrap: balance;
  margin-bottom: 10px;
  animation: heroLine 650ms var(--ease-out) 90ms both;
}

.extract-heading em {
  font-family: var(--font-editorial);
  font-style: italic;
  font-weight: 700;
  color: var(--crimson);
  position: relative;
  display: inline-block;
  letter-spacing: -0.02em;
}

.extract-heading em::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 4px;
  background: var(--crimson);
  border-radius: 2px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'%3E%3Cpath d='M0 3 Q10 0 20 3 Q30 6 40 3 Q50 0 60 3 Q70 6 80 3 Q90 0 100 3 Q110 6 120 3' stroke='black' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'%3E%3Cpath d='M0 3 Q10 0 20 3 Q30 6 40 3 Q50 0 60 3 Q70 6 80 3 Q90 0 100 3 Q110 6 120 3' stroke='black' stroke-width='2.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  mask-size: 100% 100%;
  -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  animation: underlineReveal 700ms var(--ease-out) 600ms both;
}

.extract-sub {
  font-size: 0.95rem;
  color: var(--ink-3);
  margin-bottom: 28px;
  font-weight: 400;
  max-width: 460px;
  animation: heroLine 550ms var(--ease-out) 210ms both;
}

.extract-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  max-width: 640px;
  animation: heroLine 550ms var(--ease-out) 330ms both;
}

#url-input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  font-size: 0.95rem;
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  min-width: 0;
}

#url-input:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted), var(--shadow-sm);
}

#url-input::placeholder { color: var(--ink-3); }

/* Button-in-Button CTA */
#btn-extraer {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--crimson);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 0 8px 0 20px;
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
  box-shadow: var(--shadow-crimson);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-spring);
  position: relative;
  overflow: hidden;
}

#btn-extraer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: btnSweep 4s ease-in-out 2.5s infinite;
  pointer-events: none;
}

#btn-extraer:hover {
  background: var(--crimson-dark);
  box-shadow: 0 6px 28px rgba(232, 72, 10, 0.40);
  transform: scale(1.02);
}

#btn-extraer:active { transform: scale(0.97); }
#btn-extraer:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-extraer-text { padding-right: 10px; }

.btn-extraer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.20);
  transition: transform var(--t-spring), background var(--t-fast);
}

#btn-extraer:hover .btn-extraer-icon {
  transform: translateY(2px);
  background: rgba(0, 0, 0, 0.28);
}

/* === DAILY COUNTER === */

.daily-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  max-width: 640px;
  opacity: 1;
  transition: opacity 300ms ease;
  animation: fadeUp 350ms var(--ease-out) both;
}

.daily-counter.hidden { display: none; }

.day-dots {
  display: flex;
  gap: 4px;
}

.day-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-s, rgba(0,0,0,0.15));
  transition: background 250ms ease, transform 200ms var(--ease-spring);
}

.day-dot--filled {
  background: var(--crimson);
  transform: scale(1.3);
  animation: dotPulse 500ms var(--ease-spring) both;
}

.day-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

/* === SPINNER / LOADING === */

.spinner {
  display: none;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 0.84rem;
  color: var(--ink-2);
  max-width: 480px;
  box-shadow: var(--shadow-xs);
  animation: fadeUp 200ms var(--ease-out) both;
}

.spinner.visible { display: flex; }

/* Extracción narrada: etapas + barra que se frena al acercarse al final */
.xp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.xp-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  font-size: 0.84rem;
}
.xp-steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.4;
  transition: opacity 280ms var(--ease-out);
}
.xp-steps li.active { opacity: 1; color: var(--ink); font-weight: 600; }
.xp-steps li.done   { opacity: 0.7; }
.xp-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out);
}
.xp-dot svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 260ms var(--ease-out) 60ms;
}
.xp-steps li.done .xp-dot { background: var(--crimson); border-color: var(--crimson); }
.xp-steps li.done .xp-dot svg { stroke-dashoffset: 0; }
.xp-steps li.active .xp-dot { border-color: var(--crimson); }
.xp-steps li.active .xp-dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid var(--crimson);
  border-radius: 50%;
  opacity: 0;
  animation: xpPulse 1400ms var(--ease-out) infinite;
}
@keyframes xpPulse {
  0%   { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(1.25); opacity: 0; }
}
.xp-bar { height: 4px; border-radius: 99px; background: var(--border); overflow: hidden; }
.xp-bar i {
  display: block;
  height: 100%;
  background: var(--crimson);
  border-radius: inherit;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 400ms linear;
}
.xp-note { margin: 0; font-size: 0.76rem; color: var(--ink-2); }

/* Mientras se extrae, la biblioteca pasa a segundo plano */
.library { transition: opacity 300ms var(--ease-out); }
body.is-extracting .library { opacity: 0.45; pointer-events: none; }

.spinner-ring {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--crimson);
  border-radius: 50%;
  flex-shrink: 0;
  animation: spinRing 560ms linear infinite;
}

/* === ERROR MESSAGE === */

.mensaje-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--crimson-tint);
  border: 1px solid var(--crimson-muted);
  border-left: 3px solid var(--crimson);
  border-radius: var(--r-md);
  font-size: 0.84rem;
  color: var(--crimson-dark);
  display: none;
  max-width: 580px;
  animation: fadeUp 200ms var(--ease-out) both;
}

.mensaje-error.visible { display: block; }

/* === RECIPE CARD (Double-Bezel) === */

.recipe-card-shell {
  background: var(--border);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-2xl);
  padding: 4px;
  margin-bottom: 52px;
  box-shadow: var(--shadow-lg);
}

.recipe-card {
  background: var(--surface);
  border-radius: calc(var(--r-2xl) - 4px);
  overflow: hidden;
}

/* Hero image in recipe detail */
.recipe-hero {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 440px;
  overflow: hidden;
  border-radius: calc(var(--r-2xl) - 4px) calc(var(--r-2xl) - 4px) 0 0;
  background: var(--bg-2);
}

.recipe-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}

.recipe-card-header {
  padding: 28px 28px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.recipe-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.recipe-card-top h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: -0.03em;
  flex: 1;
  min-width: 200px;
  text-wrap: balance;
}

.recipe-creator {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--crimson);
  opacity: 0.85;
  letter-spacing: 0.01em;
  margin-top: -4px;
  flex-basis: 100%;
}

.recipe-card-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--crimson-muted);
  color: var(--crimson);
  border-radius: var(--r-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  opacity: 0.9;
}

.btn-pdf {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.btn-pdf:hover {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.recipe-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.recipe-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--ink-3);
  font-weight: 500;
}

/* === RECIPE CARD BODY === */

.recipe-card-body {
  padding: 28px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.recipe-section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--crimson);
  padding-left: 10px;
  border-left: 3px solid var(--crimson);
  line-height: 1;
  margin-bottom: 4px;
}

.recipe-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

.recipe-card-body ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.recipe-card-body ul li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  color: var(--ink-2);
  transition: background var(--t-fast);
}

.recipe-card-body ul li:hover { background: var(--bg-2); }

.recipe-card-body ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  counter-reset: step-counter;
}

.recipe-card-body ol li {
  display: flex;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--ink-2);
  line-height: 1.6;
  counter-increment: step-counter;
}

.recipe-card-body ol li::before {
  content: counter(step-counter);
  min-width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: var(--crimson-muted);
  color: var(--crimson);
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.kcal-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--gold-muted);
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* === MACRO BAR === */

.macro-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  flex-wrap: wrap;
}

.macro-total {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.macro-total span {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.macro-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.macro-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--r-xl);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.macro-p { background: var(--macro-p-muted); color: var(--macro-p); }
.macro-c { background: var(--macro-c-muted); color: var(--macro-c); }
.macro-f { background: var(--macro-f-muted); color: var(--macro-f); }

/* === SERVING SCALER === */

.serving-scaler {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--bg-2);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.scaler-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  white-space: nowrap;
}

.scaler-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.scaler-btn {
  padding: 5px 14px;
  border-radius: var(--r-xl);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-spring);
  font-variant-numeric: tabular-nums;
}

.scaler-btn:hover {
  border-color: var(--crimson);
  color: var(--crimson);
  background: var(--crimson-tint);
}

.scaler-btn.active {
  background: var(--crimson);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px var(--crimson-muted);
}

.scaler-btn:active { transform: scale(0.93); }

/* === SHOPPING LIST PANEL === */

.shopping-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xl);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-spring);
}

.shopping-btn:hover {
  border-color: var(--crimson);
  color: var(--crimson);
  box-shadow: var(--shadow-sm);
}

.shopping-btn:active { transform: scale(0.95); }

.shopping-panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 360ms var(--ease-out), opacity 260ms var(--ease-out), padding 300ms var(--ease-out);
  padding: 0 16px;
}

.shopping-panel.open {
  grid-template-rows: 1fr;
  opacity: 1;
  padding: 16px;
}

.shopping-panel-inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopping-panel-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}

.shopping-list-text {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-2);
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
}

.shopping-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 7px 16px;
  background: var(--crimson);
  color: #fff;
  border-radius: var(--r-xl);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-crimson);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-spring);
}

.shopping-copy-btn:hover { background: var(--crimson-dark); }
.shopping-copy-btn:active { transform: scale(0.94); }

/* === NOTES SECTION === */

.notes-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.notes-status {
  font-size: 0.75rem;
  color: var(--ink-3);
  font-style: italic;
  transition: opacity 300ms var(--ease-out);
}

.notes-area {
  width: 100%;
  min-height: 80px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--ink-2);
  resize: vertical;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  line-height: 1.6;
}

.notes-area::placeholder { color: var(--ink-3); font-style: italic; }

.notes-area:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted);
}

/* === COOK STEP TRANSITION === */

@keyframes cookStepIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cookStepOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

.cook-step--current.entering {
  animation: cookStepIn 320ms var(--ease-spring) both;
}

/* === COOK MODE === */

.cook-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  animation: fadeUp .25s var(--ease-out) both;
}
.cook-inner {
  width: 100%; max-width: 680px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 0;
  height: 100%; justify-content: center;
}
.cook-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.cook-title {
  font-family: var(--font-display); font-size: 1rem; font-weight: 600;
  color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%;
}
.cook-close-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 130ms var(--ease-out), color 130ms var(--ease-out), transform 160ms var(--ease-spring);
}
.cook-close-btn:hover { background: var(--bg-2); color: var(--ink); }
.cook-close-btn:active { transform: scale(0.88); }
.cook-bar-wrap {
  width: 100%; height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 20px;
}
.cook-bar { height: 4px; background: var(--crimson); border-radius: 2px; transition: width .4s var(--ease-out); }
.cook-steps-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0;
}
.cook-step--prev {
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  color: var(--ink-3);
  opacity: 0.42;
  line-height: 1.5;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cook-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border); font-size: 0.63rem; font-weight: 700;
  margin-right: 8px; flex-shrink: 0; vertical-align: middle;
  position: relative; top: -1px;
}
.cook-step--current {
  font-size: clamp(1.35rem, 4vw, 1.75rem); line-height: 1.55; color: var(--ink);
  font-weight: 600;
  margin-bottom: 24px;
}
.cook-step-label {
  display: block;
  font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--crimson); margin-bottom: 14px;
}
.cook-step--next {
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  color: var(--ink-2);
  opacity: 0.55;
  line-height: 1.5;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cook-nav {
  display: flex; gap: 12px; margin-top: 36px;
}
.cook-nav-btn {
  flex: 1; height: 52px; border-radius: var(--r-xl); font-size: .92rem; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--ink-2); font-family: inherit;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 160ms var(--ease-spring);
}
.cook-nav-btn:disabled { opacity: .35; cursor: default; }
.cook-nav-btn:not(:disabled):hover { background: var(--bg-2); color: var(--ink); }
.cook-nav-btn:not(:disabled):active { transform: scale(0.97); }
.cook-nav-btn.cook-nav-primary {
  background: var(--crimson); color: #fff; border-color: var(--crimson);
}
.cook-nav-btn.cook-nav-primary:hover { background: var(--crimson-dark); border-color: var(--crimson-dark); }

/* === RECIPE ACTIONS === */

.btn-cook, .btn-share-recipe {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; font-family: inherit;
  padding: 7px 14px; border-radius: var(--r-xl); cursor: pointer;
  border: 1.5px solid var(--border-strong); background: transparent;
  color: var(--ink-2);
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out), transform 160ms var(--ease-spring);
}
.btn-cook:hover, .btn-share-recipe:hover {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
}
.btn-cook:active, .btn-share-recipe:active { transform: scale(0.96); }
.btn-cook { border-color: var(--crimson-muted); color: var(--crimson); }
.btn-cook:hover { background: var(--crimson-muted); }

.recipe-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.source-link:hover {
  background: var(--bg-2);
  color: var(--ink-2);
  border-color: var(--border-strong);
}

/* === LIBRARY SECTION === */

.library {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.library-title {
  font-family: var(--font-editorial);
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1;
  position: relative;
}

.library-title::before {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  background: var(--crimson);
  border-radius: 2px;
  margin-bottom: 12px;
}

.search-wrap {
  position: relative;
  flex-shrink: 0;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

#search-input {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: 8px 14px 8px 32px;
  font-size: 0.84rem;
  outline: none;
  width: 200px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), width var(--t-base);
}

#search-input:focus {
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted);
  width: 240px;
}

/* === CATEGORY FILTERS === */

.category-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-btn {
  padding: 7px 16px;
  border-radius: var(--r-xl);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-spring);
}

.cat-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-2);
  background: var(--bg-2);
}

.cat-btn.active {
  background: var(--crimson);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 3px 16px rgba(232, 72, 10, 0.40);
}

.cat-btn:active { transform: scale(0.94); }

/* === RECIPE GRID === */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
}

@media (max-width: 500px) {
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* --- Card shell --- */
.mini-card {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: box-shadow 280ms var(--ease-out), transform 280ms var(--ease-out);
}

.mini-card.is-entering {
  animation: cardIn 420ms var(--ease-spring) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.mini-card:hover { box-shadow: var(--shadow-xl); transform: translateY(-5px) scale(1.012); }

.mini-card:active { filter: brightness(0.95); }

/* --- Image area (top of card) --- */
.mini-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-2);
  flex-shrink: 0;
}

.mini-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease-out);
}

.mini-card:hover .mini-card-img img {
  transform: scale(1.04);
}

/* No-photo placeholder: warm gradient + centered icon */
.mini-card-no-photo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--card-bg-a, #e4e4ec) 0%, var(--card-bg-b, #d0d0dc) 100%);
}

.mini-card-no-photo svg {
  color: var(--card-icon-color, rgba(160, 100, 50, 0.40));
  width: 44px;
  height: 44px;
}

/* Category-specific placeholder palettes */
.mini-card[data-cat="Desayuno"] { --card-bg-a: #fff8e6; --card-bg-b: #ffe8b0; --card-icon-color: rgba(180, 120, 0, 0.45); }
.mini-card[data-cat="Comida"]   { --card-bg-a: #f0faf2; --card-bg-b: #c8efd4; --card-icon-color: rgba(30, 120, 60, 0.40); }
.mini-card[data-cat="Cena"]     { --card-bg-a: #f0f4ff; --card-bg-b: #c8d8f8; --card-icon-color: rgba(40, 80, 180, 0.40); }
.mini-card[data-cat="Postre"]   { --card-bg-a: #fff0f6; --card-bg-b: #ffd6eb; --card-icon-color: rgba(180, 40, 100, 0.40); }
.mini-card[data-cat="Snack"]    { --card-bg-a: #f2fce8; --card-bg-b: #d4f0b8; --card-icon-color: rgba(60, 140, 40, 0.40); }

/* Photo cards: image fills full card, title overlaid at bottom */
.mini-card.has-photo {
  background: #111;
}

.mini-card.has-photo .mini-card-img {
  aspect-ratio: 3 / 4;
}

.mini-card.has-photo .mini-card-body {
  display: none;
}

.mini-card-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 32px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
  z-index: 3;
}

.mini-card .mini-card-overlay h4 {
  font-family: var(--font-editorial);
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.mini-card-overlay .mini-card-time-overlay {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.04em;
}

/* Source platform badge */
.mini-source-badge {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.2);
}

/* Category badge — on the image, top-left */
.mini-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Sin foto no hay degradado ni título superpuesto */
.mini-card:not(.has-photo) .mini-card-overlay { display: none; }

/* On photo cards, hide the category badge (we show source instead) */
.mini-card.has-photo .mini-badge {
  display: none;
}

/* Delete button */
.mini-card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  box-shadow: var(--shadow-sm);
  transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-spring);
}

.mini-card:hover .mini-card-delete { opacity: 1; }

.mini-card-delete:hover {
  background: white;
  color: var(--crimson);
}

.mini-card-delete:active { transform: scale(0.88); }

/* --- Content area (below image) --- */
.mini-card-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3px;
  flex: 1;
}

.mini-card h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 8px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.mini-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.mini-card-creator {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--crimson);
}

.mini-card-time {
  font-size: 0.7rem;
  color: var(--ink-3);
}

/* Meta-top row: category badge + platform badge */
.mini-card-meta-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  min-height: 18px;
  padding-right: 28px;
}

/* Inline category badge (text-only cards) */
.mini-badge-inline {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--crimson);
  background: var(--crimson-muted);
  padding: 2px 7px;
  border-radius: 4px;
}

/* TikTok / Reels platform badge */
.mini-platform {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

/* === EMPTY STATE === */

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 72px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.88rem;
  animation: fadeUp 350ms var(--ease-out) both;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
}

/* === WELCOME EMPTY STATE (ONBOARD) === */

.empty-state--welcome {
  gap: 20px;
  padding: 72px 20px 80px;
}

/* Stacked recipe card illustration */
.onboard-cards {
  position: relative;
  width: 130px;
  height: 108px;
  flex-shrink: 0;
}

.onboard-card {
  position: absolute;
  width: 90px;
  height: 82px;
  border-radius: 16px;
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.onboard-card--c {
  bottom: 0;
  left: 0;
  transform: rotate(-9deg);
  background: var(--bg-2);
}

.onboard-card--b {
  bottom: 8px;
  left: 18px;
  transform: rotate(-4deg);
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}

.onboard-card--a {
  bottom: 16px;
  left: 36px;
  transform: rotate(0deg);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--crimson);
  box-shadow: var(--shadow-lg);
  border-color: rgba(232, 72, 10, 0.20);
}

.empty-welcome-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.1;
}

.empty-welcome-sub {
  font-size: 0.88rem;
  color: var(--ink-3);
  max-width: 340px;
  line-height: 1.65;
  margin: 0;
}

/* 3-step micro guide */
.onboard-steps {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
}

.onboard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 80px;
}

.onboard-step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--crimson);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.onboard-step span {
  font-size: 0.71rem;
  color: var(--ink-2);
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
}

.onboard-step-divider {
  width: 18px;
  height: 1.5px;
  background: var(--border-strong);
  flex-shrink: 0;
  margin-top: 14px;
}

/* Platform chips */
.onboard-platforms {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.onboard-platform {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1.5px solid var(--border-strong);
  color: var(--ink-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--surface);
}

.empty-cta {
  margin-top: 4px;
  padding: 13px 28px;
  background: var(--crimson);
  color: #fff;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-crimson);
  transition: transform 160ms var(--ease-spring), box-shadow var(--t-fast);
}

.empty-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(232, 72, 10, 0.45); }
.empty-cta:active { transform: scale(0.97); box-shadow: var(--shadow-crimson); }

/* Reset link in filtered empty state */
.empty-search-reset {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--crimson);
  margin-top: 2px;
  transition: opacity var(--t-fast);
}
.empty-search-reset:hover { opacity: 0.7; }

/* === BACK BUTTON === */

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  padding: 6px 0;
  margin-bottom: 16px;
  transition: color var(--t-fast), transform 160ms var(--ease-spring);
}

.btn-back:hover { color: var(--ink); transform: translateX(-3px); }
.btn-back:active { transform: translateX(-2px) scale(0.97); }

/* === EDIT BUTTON (in recipe header actions) === */

.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  transition: background var(--t-fast), color var(--t-fast), transform 160ms var(--ease-spring);
}

.btn-edit:hover { background: var(--crimson-muted); color: var(--crimson); border-color: var(--crimson); }
.btn-edit:active { transform: scale(0.96); }

/* === EDIT MODAL === */

.edit-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 200ms var(--ease-out) both;
}

@media (min-width: 600px) {
  .edit-modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.edit-modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.25);
  animation: slideUp 280ms var(--ease-spring) both;
  overflow: hidden;
}

@media (min-width: 600px) {
  .edit-modal {
    border-radius: 20px;
    max-height: 88dvh;
    box-shadow: 0 8px 60px rgba(0,0,0,0.35);
  }
}

.edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1.5px solid var(--border);
  flex-shrink: 0;
}

.edit-modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.edit-modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t-fast), color var(--t-fast), transform 160ms var(--ease-spring);
}

.edit-modal-close:hover { background: var(--crimson-muted); color: var(--crimson); }
.edit-modal-close:active { transform: scale(0.88); }

.edit-modal-body {
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.edit-hint {
  font-weight: 400;
  text-transform: none;
  opacity: 0.7;
  letter-spacing: 0;
}

.edit-field input,
.edit-field textarea,
.edit-field select {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  resize: vertical;
}

.edit-field input:focus,
.edit-field textarea:focus,
.edit-field select:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted);
}

.edit-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  flex-direction: unset;
}

.edit-row-2 > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-row-2 label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.edit-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1.5px solid var(--border);
  flex-shrink: 0;
}

.btn-cancel-edit {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg-2);
  border-radius: 10px;
  transition: background var(--t-fast), transform 160ms var(--ease-spring);
}

.btn-cancel-edit:hover { background: var(--border); }
.btn-cancel-edit:active { transform: scale(0.97); }

.btn-save-edit {
  padding: 10px 22px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: var(--crimson);
  border-radius: 10px;
  transition: opacity var(--t-fast), transform 160ms var(--ease-spring);
}

.btn-save-edit:hover { opacity: 0.88; }
.btn-save-edit:active { transform: scale(0.97); }
.btn-save-edit:disabled { opacity: 0.5; pointer-events: none; }

/* === TOAST NOTIFICATIONS === */

#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-xl);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  white-space: nowrap;
  animation: toastIn 360ms var(--ease-spring) both;
}

.toast.out {
  animation: toastOut 280ms var(--ease-out) both;
}

/* === PWA INSTALL BANNER === */

.install-banner {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  animation: installSlideUp .38s var(--ease-spring) both;
  width: calc(100% - 32px);
  max-width: 480px;
}

@keyframes installSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.install-banner-inner {
  background: var(--ink);
  color: var(--bg);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.06) inset;
}

.install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.install-banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.install-banner-text strong {
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.2;
}

.install-banner-text span {
  font-size: .74rem;
  opacity: .6;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.install-banner-text span svg { flex-shrink: 0; opacity: .9; }

#btn-install {
  height: 32px;
  padding: 0 14px;
  border-radius: 20px;
  border: none;
  background: var(--crimson);
  color: #fff;
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
#btn-install:hover  { background: var(--crimson-dark); }
#btn-install:active { transform: scale(0.97); }

#btn-dismiss-install {
  background: none;
  border: none;
  color: rgba(255,255,255,.35);
  font-size: .85rem;
  cursor: pointer;
  padding: 4px 2px;
  flex-shrink: 0;
  transition: color .15s;
  line-height: 1;
}
#btn-dismiss-install:hover { color: rgba(255,255,255,.7); }

/* === PRINT === */

@media print {
  body { background: #fff !important; color: #000 !important; }

  header,
  .extract-section,
  .library,
  .btn-pdf,
  .mini-card-delete,
  .recipe-actions,
  .serving-scaler,
  .shopping-btn,
  .shopping-panel,
  .notes-section,
  #toast-container {
    display: none !important;
  }

  main { max-width: 100%; padding: 0; }

  .recipe-card-shell {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    animation: none !important;
    margin: 0 !important;
  }

  .recipe-card { border-radius: 0 !important; }

  .recipe-card-header,
  .recipe-card-body {
    padding: 16px 0 !important;
  }

  .recipe-card-body ol li::before {
    background: #eee !important;
    color: #333 !important;
  }
}

/* === RESPONSIVE === */

@media (max-width: 600px) {

  body {
    -webkit-tap-highlight-color: transparent;
  }

  main {
    padding: 0 16px calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .header-inner {
    padding: 0 14px;
    height: 52px;
    gap: 10px;
  }

  #user-email { display: none; }

  #btn-logout {
    font-size: 0.74rem;
    padding: 6px 10px;
    min-height: 36px;
  }

  .btn-theme {
    width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .theme-panel {
    position: fixed;
    top: 62px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: 340px;
    margin-left: auto;
  }

  /* Extract section */
  .extract-section {
    padding: 36px 0 32px;
    margin-bottom: 36px;
  }

  .extract-heading {
    font-size: clamp(2rem, 9vw, 2.6rem);
    margin-bottom: 4px;
  }

  .extract-sub {
    font-size: 0.84rem;
    margin-bottom: 20px;
  }

  .extract-row {
    flex-direction: column;
    gap: 10px;
  }

  #url-input {
    padding: 14px 16px;
    font-size: 1rem;
    min-height: 52px;
    border-radius: var(--r-lg);
  }

  #btn-extraer {
    width: 100%;
    justify-content: center;
    padding: 0 20px;
    min-height: 54px;
    font-size: 1rem;
    border-radius: var(--r-lg);
  }

  .btn-extraer-icon {
    width: 38px;
    height: 38px;
  }

  /* Library title: still big on mobile */
  .library-title {
    font-size: clamp(1.8rem, 7vw, 2.4rem);
  }

  /* Recipe card: edge-to-edge */
  .recipe-card-shell {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 0;
  }

  .recipe-card { border-radius: 0; }

  .recipe-card-header {
    padding: 20px 16px 18px;
  }

  .recipe-card-body {
    padding: 18px 16px 24px;
    gap: 18px;
  }

  .recipe-card-top h2 {
    font-size: 1.5rem;
    min-width: 0;
  }

  .recipe-card-top { gap: 10px; }
  .recipe-card-top-actions { gap: 6px; flex-wrap: wrap; }

  .macro-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 14px;
  }

  .macro-total { font-size: 1.5rem; }

  .serving-scaler {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .scaler-btns { gap: 6px; flex-wrap: wrap; }

  .scaler-btn {
    padding: 10px 18px;
    font-size: 0.84rem;
    min-height: 44px;
    min-width: 56px;
  }

  .recipe-actions { gap: 8px; flex-wrap: wrap; }

  .btn-cook,
  .btn-share-recipe,
  .shopping-btn,
  .source-link {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.84rem;
  }

  /* Category filter: scrollable row */
  .category-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    gap: 6px;
  }

  .category-filters::-webkit-scrollbar { display: none; }

  .cat-btn {
    white-space: nowrap;
    padding: 9px 16px;
    min-height: 40px;
    flex-shrink: 0;
    font-size: 0.82rem;
  }

  /* Library header stacked on mobile */
  .library-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .search-wrap { width: 100%; }
  #search-input { width: 100%; }
  #search-input:focus { width: 100%; }

  /* Recipe grid: 2 columns */
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .mini-card {
    min-height: 170px;
  }

  .mini-card.has-thumb {
    min-height: 190px;
  }

  /* Delete always visible on mobile */
  .mini-card-delete {
    opacity: 1;
    width: 28px;
    height: 28px;
    background: var(--bg-2);
    color: var(--ink-3);
  }

  /* Auth modal */
  .auth-overlay {
    padding: 16px;
    align-items: flex-start;
    padding-top: max(20px, env(safe-area-inset-top, 20px));
    overflow-y: auto;
  }

  .auth-box {
    max-width: 100%;
    border-radius: var(--r-2xl);
    margin-bottom: 40px;
  }

  .auth-box-inner {
    padding: 28px 20px 24px;
    gap: 16px;
  }

  .field-group input {
    padding: 13px 14px;
    font-size: 1rem;
    min-height: 50px;
  }

  #auth-submit {
    min-height: 52px;
    font-size: 1rem;
  }

  /* Cook mode */
  .cook-inner {
    padding: 24px 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .cook-step--current {
    font-size: clamp(1.45rem, 5vw, 1.9rem);
    line-height: 1.5;
  }

  .cook-nav-btn {
    height: 58px;
    font-size: 1rem;
    border-radius: var(--r-xl);
  }

  .cook-close-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }

  #toast-container {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .install-banner {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}

/* ─── Recipe view transitions ─── */

.extract-section {
  transition: opacity 260ms cubic-bezier(0.23, 1, 0.32, 1),
              transform 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
.extract-section.section-exit {
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
  pointer-events: none;
}
.extract-section.section-hidden {
  display: none !important;
}
@keyframes sectionEnter {
  from { opacity: 0; transform: translateY(-14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.extract-section.section-enter {
  animation: sectionEnter 360ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes recipeEnter {
  from { opacity: 0; transform: translateY(36px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.recipe-card-shell.recipe-enter {
  animation: recipeEnter 440ms cubic-bezier(0.23, 1, 0.32, 1) both;
}
.btn-back.btn-back-enter {
  animation: recipeEnter 380ms cubic-bezier(0.23, 1, 0.32, 1) 60ms both;
}

@keyframes recipeExit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-12px) scale(0.98); }
}
.recipe-card-shell.recipe-exit,
.btn-back.btn-back-exit {
  animation: recipeExit 180ms ease-in both;
}

/* Extra-small phones */
/* Forgot / Reset password */
.auth-forgot-link {
  background: none;
  border: none;
  color: var(--ink-3, #999);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  width: 100%;
  text-align: center;
  margin-top: 4px;
  transition: color 150ms;
}
.auth-forgot-link:hover { color: var(--crimson); }
.forgot-view { display: flex; flex-direction: column; gap: 12px; }
.forgot-view.hidden { display: none; }
.forgot-desc { font-size: 14px; color: var(--ink-2, #666); margin: 0; line-height: 1.5; }
.forgot-success {
  font-size: 13px;
  color: var(--crimson);
  background: var(--crimson-muted);
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.5;
}
.forgot-success.hidden { display: none; }

#btn-forgot-submit, #btn-reset-submit {
  width: 100%;
  background: var(--crimson);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--r-xl);
  padding: 12px 20px;
  box-shadow: var(--shadow-crimson);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
#btn-forgot-submit:hover, #btn-reset-submit:hover {
  background: var(--crimson-dark);
  box-shadow: 0 6px 28px rgba(232, 72, 10, 0.35);
}
#btn-forgot-submit:active, #btn-reset-submit:active { transform: scale(0.97); }
#btn-forgot-submit:disabled, #btn-reset-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

@media (max-width: 390px) {
  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .mini-card h4 { font-size: 0.88rem; }
  .mini-card { min-height: 150px; }

  .recipe-card-top h2 { font-size: 1.35rem; }

  .scaler-btn {
    padding: 10px 14px;
    min-width: 50px;
  }

  main {
    padding: 0 12px calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* === SHARE MODAL === */
.share-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  animation: overlayIn 180ms ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

.share-box {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 20px;
  width: 100%;
  max-width: 520px;
  animation: sheetUp 260ms cubic-bezier(0.32,0.72,0,1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.share-box-title {
  font-size: 1rem; font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin-bottom: 20px;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.share-opt {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 8px 12px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.78rem; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 150ms ease, transform 100ms ease;
}
.share-opt:hover { background: var(--bg-2); }
.share-opt:active { transform: scale(0.96); }
.share-opt svg { width: 22px; height: 22px; }

.share-cancel {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--bg-2);
  border: none;
  color: var(--ink-2);
  font-size: 0.95rem; font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease;
}
.share-cancel:hover { background: var(--border-strong); }

/* === PUSH NOTIFICATION BANNER === */
.push-banner {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%; transform: translateX(-50%);
  z-index: 8000;
  width: calc(100% - 32px);
  max-width: 480px;
  animation: toastIn 300ms cubic-bezier(0.34,1.56,0.64,1);
}

.push-banner-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  font-size: 0.85rem; color: var(--ink-2);
}
.push-banner-inner svg { flex-shrink: 0; color: var(--crimson); }
.push-banner-inner span { flex: 1; }

#push-allow {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--crimson);
  color: #fff;
  border: none;
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer;
}
#push-dismiss {
  flex-shrink: 0;
  background: none; border: none;
  color: var(--ink-3); cursor: pointer;
  font-size: 1rem; padding: 4px;
}

/* === EXIT ANIMATIONS === */

.cook-overlay.leaving {
  animation: fadeOut 200ms var(--ease-in-out) both;
  pointer-events: none;
}

.edit-modal-overlay.leaving {
  animation: fadeOut 220ms var(--ease-in-out) both;
  pointer-events: none;
}

.edit-modal-overlay.leaving .edit-modal {
  animation: slideDown 200ms var(--ease-in-out) both;
}

.mini-card.removing {
  animation: cardOut 260ms var(--ease-in-out) both;
  pointer-events: none;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 100ms !important;
    scroll-behavior: auto !important;
  }
  .spinner-ring {
    animation-duration: 1200ms !important;
    animation-iteration-count: infinite !important;
  }
  .xp-steps li.active .xp-dot::after { animation: none; }
}
