/* YouppyChef. I colori stanno tutti qui sotto, una volta per il tema chiaro e una per lo scuro. Accento corallo #e8562b. */
@font-face { font-family: 'Baloo 2'; src: url('/caratteri/Baloo2.ttf') format('truetype'); font-weight: 400 800; font-display: swap; }

[data-tema="chiaro"] {
  --sfondo: #f7f3f0; --carta: #ffffff; --testo: #221c18; --tenue: #7c726b; --linea: #ece3dd;
  --accento: #e8562b; --accento-forte: #cf461f; --su-accento: #ffffff; --accento-tenue: #fde9e1;
  --verde: #1f9d57; --verde-tenue: #e3f6ec; --giallo: #f2b134; --rosso: #d8392f; --blu: #3568d4; --blu-tenue: #e7eeff;
  --ombra: 0 2px 12px rgba(90, 40, 20, .08); --interruttore: #d9cfc8;
}
[data-tema="scuro"] {
  --sfondo: #14110f; --carta: #1f1a17; --testo: #f1ebe6; --tenue: #a39890; --linea: #322a25;
  --accento: #ff6f45; --accento-forte: #ff855f; --su-accento: #1a120e; --accento-tenue: #3a241b;
  --verde: #46cf85; --verde-tenue: #1d3327; --giallo: #f4c35f; --rosso: #ff6b60; --blu: #7e9bff; --blu-tenue: #202a46;
  --ombra: 0 2px 12px rgba(0, 0, 0, .4); --interruttore: #3c322c;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--sfondo); color: var(--testo); font: 16px/1.45 system-ui, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--giallo); outline-offset: 2px; }
h1, h2, h3 { font-family: 'Baloo 2', system-ui, sans-serif; margin: 0; line-height: 1.15; }
p { margin: 0; }
[hidden] { display: none !important; }
.icona { display: inline-flex; width: 24px; height: 24px; flex: none; }
.icona svg { width: 100%; height: 100%; }

#app { height: 100dvh; max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; background: var(--sfondo); position: relative; overflow: hidden; }
#vista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
@media (min-width: 660px) { body { background: color-mix(in srgb, var(--sfondo) 82%, var(--accento) 18%); } #app { box-shadow: 0 0 60px rgba(60, 20, 0, .18); } }

/* ---- barra in basso ---- */
#barra { display: flex; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--carta); border-top: 1px solid var(--linea); z-index: 2; }
#barra button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 3px; color: var(--tenue); font-size: 11px; font-weight: 600; border-radius: 14px; }
#barra button.attiva { color: var(--accento); }
#barra button.attiva .icona { background: var(--accento-tenue); border-radius: 12px; }
#barra .icona { width: 48px; height: 28px; padding: 3px 12px; transition: background .2s; }

/* ---- pezzi comuni ---- */
.pagina { padding: calc(14px + env(safe-area-inset-top)) 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.testata { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.testata h1 { flex: 1; min-width: 0; font-size: clamp(23px, 7vw, 28px); font-weight: 800; }
.testata h1 b { color: var(--accento); }
.tondo { width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--tenue); transition: background .15s, transform .1s; }
.tondo:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.tondo:active { transform: scale(.92); }
.tondo.pieno { background: var(--accento); color: var(--su-accento); box-shadow: 0 6px 16px color-mix(in srgb, var(--accento) 40%, transparent); }
.tondo.piccolo { width: 34px; height: 34px; }
.tondo.piccolo .icona { width: 19px; height: 19px; }
.carta { background: var(--carta); border-radius: 20px; padding: 16px; box-shadow: var(--ombra); }
.nota { color: var(--tenue); font-size: 14px; }
.nota.centro { text-align: center; }
.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 16px; background: var(--accento); color: var(--su-accento); font-weight: 700; font-family: 'Baloo 2', system-ui, sans-serif; font-size: 18px; transition: transform .1s, background .15s; }
.bottone:hover { background: var(--accento-forte); }
.bottone:active { transform: scale(.97); }
.bottone:disabled { opacity: .45; cursor: default; transform: none; }
.bottone.secondario { background: var(--accento-tenue); color: var(--accento); }
.bottone.chiaro { background: var(--sfondo); color: var(--testo); }
.bottone.pericolo { background: none; color: var(--rosso); }
.bottone.largo { width: 100%; }
.pillola { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 13px; border-radius: 999px; background: var(--accento-tenue); color: var(--accento); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.pillola.tenue { background: var(--sfondo); color: var(--tenue); }
.pillola.verde { background: var(--verde-tenue); color: var(--verde); }
.pillola .icona { width: 16px; height: 16px; }
.vuoto { text-align: center; padding: 34px 20px; color: var(--tenue); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vuoto > .icona { width: 54px; height: 54px; color: var(--linea); }
.vuoto h3 { color: var(--testo); font-size: 20px; }

/* interruttore */
.interruttore { width: 52px; height: 32px; border-radius: 16px; background: var(--interruttore); position: relative; flex: none; transition: background .2s; }
.interruttore::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); transition: transform .2s; }
.interruttore[aria-checked="true"] { background: var(--accento); }
.interruttore[aria-checked="true"]::after { transform: translateX(20px); }

/* ---- ricerca e filtri ---- */
.cerca { display: flex; align-items: center; gap: 8px; background: var(--carta); border: 1px solid var(--linea); border-radius: 16px; padding: 0 12px; height: 50px; box-shadow: var(--ombra); }
.cerca .icona { width: 20px; height: 20px; color: var(--tenue); }
.cerca input { flex: 1; min-width: 0; border: 0; background: none; height: 100%; }
.filtri { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.filtri::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--carta); border: 1px solid var(--linea); color: var(--testo); font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accento); color: var(--su-accento); border-color: var(--accento); }
.chip .icona { width: 15px; height: 15px; }
.conteggio { color: var(--tenue); font-size: 13.5px; font-weight: 600; padding: 0 2px; }

/* ---- scheda ricetta nella lista ---- */
.r-lista { display: flex; flex-direction: column; gap: 10px; }
.r-card { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: var(--carta); border-radius: 18px; padding: 12px 14px; box-shadow: var(--ombra); transition: transform .08s; }
.r-card:active { transform: scale(.985); }
.r-card .corpo { flex: 1; min-width: 0; }
/* il nome va su due righe al massimo: a 360 px tagliato su una riga sola non si leggeva */
.r-card h3 { font-size: 17px; font-weight: 700; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.r-card .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--tenue); font-size: 13px; margin-top: 3px; }
.r-card .meta span { display: inline-flex; align-items: center; gap: 4px; }
.r-card .meta .icona { width: 14px; height: 14px; }
.r-card .cuore { flex: none; color: var(--tenue); }
.r-card .cuore.attivo { color: var(--accento); }
.r-card .cat { width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--accento-tenue); color: var(--accento); display: grid; place-items: center; font-size: 22px; }
.tag-riga { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 7px; background: var(--verde-tenue); color: var(--verde); text-transform: uppercase; letter-spacing: .02em; }
.tag.grigio { background: var(--sfondo); color: var(--tenue); }

/* ---- foglio dettaglio ricetta ---- */
.dett-badge { display: flex; flex-wrap: wrap; gap: 8px; }
.dett-sezione h3 { font-size: 16px; margin-bottom: 8px; }
.ingredienti { display: flex; flex-direction: column; }
.ingredienti li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--linea); list-style: none; }
.ingredienti { margin: 0; padding: 0; }
.ingredienti .q { color: var(--accento); font-weight: 700; white-space: nowrap; }
.passi { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: p; }
.passi li { display: flex; gap: 12px; list-style: none; }
.passi li::before { counter-increment: p; content: counter(p); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accento); color: var(--su-accento); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.porzioni-sel { display: flex; align-items: center; gap: 12px; }
.porzioni-sel .tondo { background: var(--sfondo); color: var(--testo); }
.porzioni-sel b { font-size: 20px; min-width: 2.4em; text-align: center; }

/* ---- form (fogli) ---- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-size: 13px; font-weight: 700; color: var(--tenue); text-transform: uppercase; letter-spacing: .04em; }
.campo input[type="text"], .campo input[type="search"], .campo input[type="number"], .campo select, .campo textarea { min-height: 48px; border-radius: 14px; border: 1px solid var(--linea); background: var(--sfondo); padding: 11px 14px; width: 100%; }
.campo textarea { resize: vertical; min-height: 72px; line-height: 1.4; }
.segmenti { display: flex; gap: 6px; background: var(--sfondo); border-radius: 14px; padding: 4px; }
.segmenti button { flex: 1; min-height: 40px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--tenue); }
.segmenti button[aria-pressed="true"] { background: var(--carta); color: var(--accento); box-shadow: var(--ombra); }
.scelte { display: flex; flex-wrap: wrap; gap: 8px; }
.scelte .chip:not([aria-pressed="true"]) { background: var(--sfondo); }

/* ---- menù ---- */
.giorno { background: var(--carta); border-radius: 18px; padding: 14px 16px; box-shadow: var(--ombra); display: flex; flex-direction: column; gap: 10px; }
.giorno > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.giorno > header h3 { font-size: 18px; }
.giorno > header span { color: var(--tenue); font-size: 13px; }
.pasto { display: flex; flex-direction: column; gap: 4px; }
.pasto .etichetta { font-size: 12px; font-weight: 700; color: var(--accento); text-transform: uppercase; letter-spacing: .05em; }
.pasto button { display: flex; align-items: center; gap: 8px; text-align: left; padding: 5px 0; }
.pasto button .pallino { width: 7px; height: 7px; border-radius: 50%; background: var(--linea); flex: none; }
.pasto button b { font-weight: 600; }
.pasto button small { color: var(--tenue); margin-left: auto; white-space: nowrap; }
.spesa li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--linea); list-style: none; }
.spesa { margin: 0; padding: 0; }
.spesa .q { color: var(--accento); font-weight: 700; white-space: nowrap; }
.fonte { display: flex; align-items: flex-start; gap: 8px; background: var(--blu-tenue); color: var(--blu); border-radius: 14px; padding: 10px 12px; font-size: 13.5px; }
.fonte .icona { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---- reel e post ---- */
.s-lista { display: flex; flex-direction: column; gap: 16px; }
.s-card { background: var(--carta); border-radius: 20px; overflow: hidden; box-shadow: var(--ombra); }
.s-video { position: relative; background: #000; aspect-ratio: 9 / 16; max-height: 72dvh; margin: 0 auto; width: 100%; }
.s-video video { width: 100%; height: 100%; object-fit: contain; display: block; cursor: pointer; }
.s-audio { position: absolute; right: 10px; bottom: 10px; background: rgba(0, 0, 0, .5); color: #fff; }
.s-audio:hover { background: rgba(0, 0, 0, .7); }
.s-foto { width: 100%; max-height: 80dvh; object-fit: cover; display: block; background: var(--sfondo); }
.s-corpo { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.s-riga { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; }
.s-autore { font-weight: 700; overflow-wrap: anywhere; }
.s-riga .pillola { margin-left: auto; min-height: 28px; font-size: 12.5px; }
.s-testo { white-space: pre-line; overflow-wrap: anywhere; }
.s-corpo > .pillola { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pillola.rossa { background: color-mix(in srgb, var(--rosso) 14%, transparent); color: var(--rosso); }
.s-azioni { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.s-mipiace { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 6px; color: var(--tenue); font-weight: 700; }
.s-mipiace.attivo { color: var(--accento); }
.s-scegli { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 160px; border: 2px dashed var(--linea); border-radius: 18px; background: var(--sfondo); color: var(--tenue); padding: 14px; overflow: hidden; }
.s-scegli > .icona { width: 40px; height: 40px; }
.s-scegli b { color: var(--testo); }
.s-scegli video, .s-scegli img { max-width: 100%; max-height: 40dvh; border-radius: 12px; display: block; }

/* ---- fogli (dal basso) ---- */
#strati:empty { display: none; }
.velo { position: fixed; inset: 0; background: rgba(10, 8, 20, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: appare .2s; }
.foglio { width: 100%; max-width: 620px; max-height: 92dvh; overflow-y: auto; background: var(--carta); border-radius: 26px 26px 0 0; padding: 10px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; animation: sale .25s cubic-bezier(.2, .8, .3, 1); }
.foglio .maniglia { width: 40px; height: 5px; border-radius: 3px; background: var(--linea); margin: 0 auto 2px; flex: none; }
.foglio .testata h2 { flex: 1; font-size: 22px; min-width: 0; }
.riga-btn { display: flex; gap: 10px; }
.riga-btn .bottone { flex: 1; }

#avviso { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--testo); color: var(--sfondo); padding: 10px 18px; border-radius: 14px; z-index: 50; font-size: 14.5px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); animation: appare .2s; }
.caricamento { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: var(--tenue); }
.caricamento .giro { width: 22px; height: 22px; border: 3px solid var(--linea); border-top-color: var(--accento); border-radius: 50%; animation: ruota .8s linear infinite; }

@keyframes appare { from { opacity: 0; } }
@keyframes sale { from { transform: translateY(40%); opacity: 0; } }
@keyframes ruota { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
