:root {
  --bg: #f3f7f5;
  --surface: #ffffff;
  --surface-2: #e9f2ef;
  --ink: #15262d;
  --muted: #5c6d73;
  --line: #dce6e3;
  --primary: #2f8f83;
  --primary-ink: #ffffff;
  --primary-soft: #dcf0ec;
  --accent: #e8664a;
  --accent-soft: #fde9e3;
  --gold: #d99a2b;
  --danger: #c2412f;
  --shadow: 0 6px 20px rgba(21, 38, 45, .07);
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a1e;
    --surface: #162529;
    --surface-2: #1d3035;
    --ink: #e7f0ee;
    --muted: #97a9ad;
    --line: #26393e;
    --primary: #4fbcad;
    --primary-ink: #0b1a1d;
    --primary-soft: #1b3a38;
    --accent: #f07b60;
    --accent-soft: #3a2420;
    --gold: #e6b04f;
    --danger: #f0806e;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 800; }
h1 { font-size: 30px; }
h2 { font-size: 25px; }
h3 { font-size: 19px; }
p { margin: 0; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.screen { max-width: 520px; margin: 0 auto; padding: 28px 16px 40px; }
.screen.center { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.brand-big { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.intro { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
#profile-form { gap: 14px; }

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

label { font-weight: 700; font-size: 15px; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  width: 100%;
  min-height: 48px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; }

.btn {
  font: inherit; font-weight: 800;
  border: 0; border-radius: 16px;
  padding: 13px 18px; min-height: 50px;
  cursor: pointer; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn.big { min-height: 58px; font-size: 19px; }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 15px; align-self: flex-start; }
.link { text-align: center; font-weight: 700; }
.error { color: var(--danger); font-weight: 700; font-size: 15px; }
.note { background: var(--primary-soft); border-radius: 16px; padding: 14px; font-size: 15px; }
.note.small { font-size: 13px; padding: 12px; }

/* App */
#app main { max-width: 560px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.top { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }

.hero { text-align: center; background: linear-gradient(160deg, var(--primary), #3aa58f); color: #fff; border: 0; padding: 26px 18px 20px; }
.timer { display: flex; justify-content: center; gap: 22px; }
.timer div { display: flex; flex-direction: column; align-items: center; }
.timer strong { font-size: 46px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer span { font-size: 14px; opacity: .9; margin-top: 4px; }
.hero-sub { margin-top: 10px; font-weight: 700; opacity: .95; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.stat strong { font-size: 25px; font-weight: 800; font-variant-numeric: tabular-nums; word-break: break-word; }
.stat strong.small-strong { font-size: 16px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

.btn.craving {
  flex-direction: column; gap: 2px;
  background: var(--accent); color: #fff;
  min-height: 86px; border-radius: 24px;
  box-shadow: 0 10px 24px rgba(232, 102, 74, .3);
}
.craving-title { font-size: 22px; }
.craving-sub { font-size: 14px; font-weight: 600; opacity: .92; }

.next p { font-weight: 700; margin: 6px 0 10px; }
.bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--primary); border-radius: 6px; transition: width .6s ease; }
.next .muted { display: block; margin-top: 8px; }
.reason p, .quote p { margin-top: 6px; font-size: 18px; font-weight: 700; }

/* Salud */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.dot { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; color: var(--muted); font-size: 15px; }
.timeline li.done .dot { background: var(--primary); color: var(--primary-ink); }
.timeline .card { padding: 14px; }
.timeline .when { font-size: 13px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; }
.timeline li:not(.done) .when { color: var(--muted); }
.timeline .bar { margin-top: 10px; height: 7px; }

/* Diario */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); padding: 4px; border-radius: 16px; }
.seg { font: inherit; font-weight: 800; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 12px; cursor: pointer; }
.seg.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.entry { display: flex; gap: 12px; align-items: flex-start; }
.entry .tag { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; }
.entry .tag.ok { background: var(--primary-soft); color: var(--primary); }
.entry .tag.slip { background: var(--accent-soft); color: var(--accent); }
.entry .tag.note { background: var(--surface-2); }
.entry-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entry-body p { overflow-wrap: anywhere; }
.entry .del { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.empty { text-align: center; padding: 10px; }
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; }
.badge .medal { font-size: 34px; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); filter: grayscale(1); opacity: .5; }
.badge.won .medal { background: #fbefd5; filter: none; opacity: 1; }
.badge strong { font-size: 15px; }
.badge span { font-size: 13px; color: var(--muted); }

.help { background: var(--primary-soft); border-color: transparent; }
.credit { text-align: center; padding: 8px; }

/* Barra de abajo */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabbtn { font: inherit; font-size: 13px; font-weight: 700; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; cursor: pointer; }
.tabbtn svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabbtn[data-tab="mas"] svg circle { fill: currentColor; stroke: none; }
.tabbtn.active { color: var(--primary); }

/* Momento de ganas */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  overflow-y: auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.sos-top { display: flex; justify-content: space-between; align-items: center; max-width: 520px; margin: 0 auto 10px; }
.icon-btn { font: inherit; font-size: 20px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.sos-clock { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); }
.sos-step { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.breath-wrap { position: relative; height: 290px; display: grid; place-items: center; }
.breath {
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #8fdccf, var(--primary));
  box-shadow: 0 0 0 18px var(--primary-soft);
  transform: scale(1);
  transition-property: transform; transition-timing-function: ease-in-out;
}
.breath-word { position: absolute; font-size: 24px; font-weight: 800; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.2); }
.idea { padding: 26px 18px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.idea-emoji { font-size: 48px; }
.idea p { font-size: 20px; font-weight: 700; }
.game { position: relative; height: 360px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; touch-action: manipulation; }
.bubble {
  position: absolute; border: 0; border-radius: 50%; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(79,188,173,.55) 45%, rgba(47,143,131,.85));
  animation: rise linear forwards;
}
.bubble.pop { animation: pop .18s ease-out forwards; }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(-460px); } }
@keyframes pop { to { transform: scale(1.6); opacity: 0; } }

/* Diálogos */
dialog {
  border: 0; border-radius: 24px; padding: 20px;
  width: min(92vw, 460px);
  background: var(--surface); color: var(--ink);
}
dialog::backdrop { background: rgba(10, 20, 24, .5); }
.chips { display: flex; gap: 8px; }
.chips.wrap { flex-wrap: wrap; }
.chips button { font: inherit; font-weight: 700; font-size: 15px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 8px 14px; min-height: 42px; cursor: pointer; }
#log-intensity button { flex: 1; }
.chips button.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); font-weight: 700;
  padding: 12px 18px; border-radius: 14px; z-index: 40; max-width: 90vw; text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; }
}

.segmented.two { grid-template-columns: 1fr 1fr; }
.center-text { text-align: center; }

/* Prueba gratis y planes */
.card.trial { font: inherit; color: var(--ink); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; background: #fbefd5; border-color: transparent; }
.card.trial strong { font-size: 19px; }
.card.trial .small { color: #8a5a00; font-weight: 700; }
@media (prefers-color-scheme: dark) { .card.trial { background: #3a2f17; } .card.trial .small { color: var(--gold); } }
#plans { width: 100%; text-align: left; }
.plan-zone h3 { font-size: 16px; }
.plan { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; }
a.plan { border-color: var(--primary); }
a.plan:active { transform: scale(.98); }
.plan-name { font-weight: 800; }
.plan strong { grid-row: span 2; font-size: 18px; color: var(--primary); }
.plan-note { font-size: 13px; color: var(--muted); }
.plan.soon { opacity: .6; }
.gift { background: var(--primary-soft); border-color: transparent; }


/* AUTH V2 · estructura y tokens de eBooks/Invitaciones de la Suite. */
.dc-auth-screen {
  min-height:100vh; min-height:100dvh; display:flex; align-items:center; justify-content:center;
  padding:calc(32px + env(safe-area-inset-top,0px)) max(20px,env(safe-area-inset-right,0px)) calc(32px + env(safe-area-inset-bottom,0px)) max(20px,env(safe-area-inset-left,0px)); color:#fff; font:16px/1.5 Inter,Arial,sans-serif;
  background:radial-gradient(circle at top left,rgba(110,74,142,.14),transparent 35%),linear-gradient(135deg,#090a28 0%,#111336 55%,#0b0c2b 100%);
}
.dc-auth-card { width:min(100%,720px); padding:42px 40px; border-radius:24px; border:1px solid rgba(212,162,76,.48); background:rgba(20,22,53,.97); box-shadow:0 30px 80px rgba(0,0,0,.28); }
.dc-auth-eyebrow { margin:0 0 14px; color:#e8ba55; font-size:12px; font-weight:800; letter-spacing:.17em; text-transform:uppercase; }
.dc-product-chip { display:inline-flex; align-items:center; margin-bottom:18px; padding:7px 12px; border:1px solid rgba(212,162,76,.28); border-radius:999px; background:rgba(212,162,76,.08); color:#d9b85f; font-size:11px; font-weight:800; letter-spacing:.12em; }
.dc-auth-title { margin:0 0 18px; color:#f2d188; font-family:Georgia,"Times New Roman",serif; font-size:clamp(32px,5vw,44px); line-height:1.08; font-weight:500; text-transform:uppercase; overflow-wrap:break-word; }
.dc-auth-copy { margin:0 0 26px; color:#e4e4ec; font-size:16px; line-height:1.6; }
.dc-auth-label { display:block; margin:18px 0 8px; color:#fff; font-size:13px; font-weight:800; text-transform:uppercase; }
.dc-auth-input { width:100%; min-height:52px; padding:0 15px; border:1px solid rgba(255,255,255,.2); border-radius:14px; outline:none; background:#0e102e; color:#fff; font:inherit; }
.dc-auth-input:focus { border-color:#d4a24c; box-shadow:0 0 0 3px rgba(212,162,76,.12); outline:0; }
.dc-password-wrap { position:relative; }
.dc-password-wrap .dc-auth-input { padding-right:58px; }
.dc-password-toggle { position:absolute; top:50%; right:8px; width:42px; height:42px; display:flex; align-items:center; justify-content:center; transform:translateY(-50%); border:0; border-radius:10px; background:transparent; color:#bfc2d5; cursor:pointer; }
.dc-password-toggle:hover { color:#f2d188; background:rgba(255,255,255,.05); }
.dc-password-toggle svg { width:21px; height:21px; pointer-events:none; }
.dc-auth-button,.dc-auth-secondary { display:flex; width:100%; align-items:center; justify-content:center; min-height:52px; border-radius:14px; font:inherit; font-size:16px; font-weight:800; cursor:pointer; }
.dc-auth-button { margin-top:22px; border:0; background:linear-gradient(135deg,#f2d188,#d4a24c); color:#090a28; padding:12px 16px; }
.dc-auth-button:hover { filter:brightness(1.05); }
.dc-auth-button:disabled { opacity:.65; cursor:wait; }
.dc-auth-secondary { border:1px solid rgba(212,162,76,.65); background:transparent; color:#f2d188; padding:12px 16px; }
.dc-auth-actions { margin-top:22px; text-align:center; }
.dc-auth-link,.dc-auth-muted { display:inline-block; border:0; padding:0; background:transparent; color:#f0c75e; font:inherit; font-weight:600; cursor:pointer; text-decoration:none; }
.dc-auth-link { min-height:44px; }
.dc-auth-first { margin:20px 0 12px; color:#fff; font-size:15px; }
.dc-auth-muted { margin-top:22px; min-height:44px; color:#bfc2d5; font-size:14px; }
.dc-auth-link:hover,.dc-auth-muted:hover,.dc-auth-suite:hover { text-decoration:underline; }
.dc-auth-suite { display:block; margin-top:24px; text-align:center; color:#f0c75e; font-size:14px; font-weight:600; text-decoration:none; }
.dc-auth-note { margin:2px 0 0; color:#aeb1c8; font-size:13px; line-height:1.5; }
.dc-auth-hint { margin-top:12px; color:#f2d188; font-size:13px; }
.dc-auth-message { margin-top:16px; padding:12px 14px; border-radius:12px; background:rgba(190,50,50,.13); border:1px solid rgba(255,120,120,.22); color:#ffd2d2; font-size:14px; line-height:1.5; }
.dc-auth-message[data-type="success"] { background:rgba(46,125,94,.15); border-color:rgba(111,206,158,.35); color:#c0f1d9; }
.dc-auth-screen button:focus-visible,.dc-auth-suite:focus-visible { outline:2px solid #f2d188; outline-offset:4px; }
.login-carga { min-height:100dvh; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; padding-bottom:40px; }
@media(max-width:600px) { .dc-auth-screen { padding:calc(24px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) calc(24px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px)); align-items:flex-start; } .dc-auth-card { padding:30px 22px; border-radius:20px; } .dc-auth-title { font-size:clamp(28px,8vw,38px); } }

.dc-auth-screen { color-scheme:dark; }
.dc-auth-legal { margin-top:12px; color:#bfc2d5; font-size:12px; }
