html, body { margin: 0; height: 100%; background: #E9E4D8; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: #3A362F; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
#app { position: relative; max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh; overflow: hidden; background: #FAF6F0; }
@media (min-width: 520px) { #app { box-shadow: 0 0 0 1px #DDD4C4, 0 12px 40px rgba(58, 54, 47, 0.12); } }
#app > div { width: 100%; height: 100%; }
#app button, #app a { -webkit-tap-highlight-color: transparent; }
#app a:focus-visible, #app button:focus-visible, #app input:focus-visible, #app textarea:focus-visible { outline: 2px solid #C97A56; outline-offset: 2px; }
#app input, #app textarea { -webkit-appearance: none; appearance: none; }
html.app-dark, html.app-dark body { background: #1A1814; }
html.app-dark #app { background: #221F19; }
#app.dark-filter { filter: invert(0.9) hue-rotate(180deg); background: #FAF6F0; }
#app.dark-filter img { filter: invert(1) hue-rotate(180deg); }
.toast { position: fixed; left: 50%; bottom: 104px; transform: translate(-50%, 12px); max-width: 340px; width: calc(100% - 48px); box-sizing: border-box; padding: 12px 16px; border-radius: 12px; background: #3A362F; color: #FAF6F0; font: 500 13px/1.45 'Inter', system-ui, sans-serif; text-align: center; opacity: 0; transition: opacity .2s, transform .2s; z-index: 10; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
/* Los bloques dentro de una zona con scroll mantienen su alto (evita que se aplasten) */
#app [style*="overflow-y: auto"] > *, #app [style*="overflow-y:auto"] > * { flex-shrink: 0; }
/* Hoja de opciones */
.sheet-back { position: fixed; inset: 0; background: rgba(34, 31, 25, 0.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; opacity: 0; transition: opacity .2s; }
.sheet-back.show { opacity: 1; }
.sheet { width: 100%; max-width: 480px; box-sizing: border-box; background: #FAF6F0; border-radius: 20px 20px 0 0; padding: 22px 20px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; transform: translateY(24px); transition: transform .2s; font-family: 'Inter', system-ui, sans-serif; }
.sheet-back.show .sheet { transform: none; }
.sheet-title { margin: 0; font: 600 20px/1.3 'Lora', Georgia, serif; color: #3A362F; }
.sheet-text { margin: 0 0 6px; font-size: 13px; line-height: 1.5; color: #6E6656; }
.sheet-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; background: #FFFFFF; border: 1px solid #EAE2D6; border-radius: 14px; cursor: pointer; text-align: left; font-family: inherit; }
.sheet-opt.primary { border-color: #5C7A85; }
.sheet-opt-label { font-size: 15px; font-weight: 600; color: #3A362F; }
.sheet-opt-hint { font-size: 12px; color: #6E6656; }
.sheet-cancel { padding: 12px; background: none; border: none; font: 600 14px 'Inter', system-ui, sans-serif; color: #6E6656; cursor: pointer; }
html.app-dark .sheet-back .sheet { filter: invert(0.9) hue-rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .sheet-back, .sheet { transition: none; } }

/* Ficha Pensamiento en continuo: control deslizante */
.cont-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
.cont-range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: #EAE2D6; }
.cont-range::-moz-range-track { height: 6px; border-radius: 6px; background: #EAE2D6; }
.cont-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: #3A362F; border: 3px solid #FFFFFF; box-shadow: 0 1px 4px rgba(58,54,47,.35); }
.cont-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #3A362F; border: 3px solid #FFFFFF; box-shadow: 0 1px 4px rgba(58,54,47,.35); }

/* Cartel de novedades (aparece solo cuando hay una versión nueva) */
.upd-back { position: fixed; inset: 0; background: rgba(34, 31, 25, 0.45); display: flex; align-items: center; justify-content: center; padding: 24px; box-sizing: border-box; z-index: 30; opacity: 0; transition: opacity .2s; }
.upd-back.show { opacity: 1; }
.upd-box { width: 100%; max-width: 360px; box-sizing: border-box; background: #FAF6F0; border-radius: 20px; padding: 24px 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; font-family: 'Inter', system-ui, sans-serif; box-shadow: 0 16px 40px rgba(34, 31, 25, 0.25); transform: translateY(10px); transition: transform .2s; }
.upd-back.show .upd-box { transform: none; }
.upd-icon { width: 48px; height: 48px; border-radius: 999px; background: #F3DFD2; color: #C97A56; display: flex; align-items: center; justify-content: center; }
.upd-title { margin: 4px 0 0; font: 600 20px/1.3 'Lora', Georgia, serif; color: #3A362F; }
.upd-detail { margin: 0; font-size: 14px; line-height: 1.5; color: #3A362F; font-weight: 500; }
.upd-text { margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; color: #5B5548; }
.upd-btn { width: 100%; padding: 14px; background: #C97A56; color: #FFFFFF; border: none; border-radius: 14px; font: 600 15px 'Inter', system-ui, sans-serif; cursor: pointer; }
.upd-later { padding: 10px; background: none; border: none; font: 600 14px 'Inter', system-ui, sans-serif; color: #6E6656; cursor: pointer; }
html.app-dark .upd-back .upd-box { filter: invert(0.9) hue-rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .upd-back, .upd-box { transition: none; } }
