:root {
  --bg: #f5f1e8;
  --card: #fffdf8;
  --ink: #23302a;
  --muted: #7b8079;
  --line: #e6dfd0;
  --green: #2f5d4a;
  --green-soft: #e3ece4;
  --terra: #c2603d;
  --terra-soft: #f6e3da;
  --amber: #b9812a;
  --amber-soft: #f6ecd6;
  --radius: 18px;
  --serif: ui-serif, "New York", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

#app { max-width: 640px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 18px calc(96px + var(--safe-b)); }

header.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
header.top h1 { font-family: var(--serif); font-weight: 600; font-size: 32px; letter-spacing: -0.02em; margin: 0; line-height: 1.05; }
header.top .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.iconbtn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 500; margin-bottom: 4px; cursor: pointer; background: none; border: 0; padding: 0; }

h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 26px 0 10px; }
h2 small { font-family: var(--sans); font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); min-height: 54px; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 500; overflow-wrap: anywhere; }
.row .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.empty { color: var(--muted); text-align: center; padding: 26px 12px; font-size: 15px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: block; }
.tile .n { font-family: var(--serif); font-size: 30px; font-weight: 600; }
.tile .l { color: var(--muted); font-size: 13px; }

.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 600; background: var(--green); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.block { width: 100%; }
.btn.soft { background: var(--green-soft); color: var(--green); }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
.btn.danger { background: var(--terra-soft); color: var(--terra); }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 11px; }
.btn:disabled { opacity: .5; }

.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c9c1ae; background: transparent; flex: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.check.on { background: var(--green); border-color: var(--green); }
.check.on::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.row.done .t { text-decoration: line-through; color: var(--muted); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus, textarea:focus, select:focus { border-color: var(--green); }
textarea { min-height: 90px; resize: vertical; }
.inline { display: flex; gap: 8px; }
.inline > * { flex: 1; min-width: 0; }

.addbar { display: flex; gap: 8px; position: sticky; top: calc(var(--safe-t) + 6px); z-index: 5; }
.addbar input { flex: 1; box-shadow: 0 4px 18px rgba(60, 50, 30, .06); }
.addbar .btn { padding: 0 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--green); color: #fff; border-color: var(--green); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.badge.red { background: var(--terra-soft); color: var(--terra); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.grey { background: #eee9de; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.plantgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plant { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.plant .ph { aspect-ratio: 1; background: var(--green-soft) center/cover no-repeat; display: grid; place-items: center; font-size: 42px; }
.plant .bd { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plant .nm { font-weight: 600; line-height: 1.2; }
.plant .btn { margin-top: auto; }
.plant.thirsty { border-color: #e8b9a6; }
.hero { width: 100%; aspect-ratio: 4/3; border-radius: var(--radius); background: var(--green-soft) center/cover no-repeat; display: grid; place-items: center; font-size: 64px; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.note { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.note .t { font-weight: 600; margin-bottom: 4px; }
.note .b { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.editor input { border: 0; background: transparent; font-family: var(--serif); font-size: 26px; font-weight: 600; padding: 4px 0; }
.editor textarea { border: 0; background: transparent; padding: 4px 0; min-height: 60vh; font-size: 17px; line-height: 1.5; }
.lock { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.fab { position: fixed; right: max(18px, calc(50% - 302px)); bottom: calc(84px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; border: 0; font-size: 30px; line-height: 1; box-shadow: 0 8px 24px rgba(47, 93, 74, .35); cursor: pointer; z-index: 20; }

#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; background: rgba(250, 247, 240, .92); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 8px; min-width: 58px; }
#tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#tabbar a.on { color: var(--green); font-weight: 600; }

.sheet-bg { position: fixed; inset: 0; background: rgba(30, 30, 20, .35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; border-radius: 22px 22px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); max-height: 92vh; overflow-y: auto; animation: up .22s cubic-bezier(.2, .8, .3, 1); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #d6cfbf; margin: 0 auto 12px; }
.sheet h3 { font-family: var(--serif); font-size: 22px; margin: 4px 0 16px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 15px; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: 90vw; display: flex; gap: 14px; align-items: center; }
#toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#toast button { background: none; border: 0; color: #9fd3b8; font-weight: 600; padding: 0; cursor: pointer; }

.auth { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.auth .logo { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 18px; }
.auth h1 { font-family: var(--serif); font-size: 36px; margin: 0 0 6px; }
.auth p { color: var(--muted); margin: 0 0 24px; }
.err { color: var(--terra); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.hint code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: #ece6d8; padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.steps { padding-left: 20px; margin: 8px 0; line-height: 1.55; font-size: 15px; }
.big-ok { text-align: center; padding: 60px 10px; }
.big-ok .e { font-size: 64px; }
.big-ok h1 { font-family: var(--serif); font-size: 28px; margin: 12px 0 24px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.who { width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
.seg { display: flex; background: #ebe5d7; border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); font-weight: 600; }
.cat { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 18px 4px 6px; }
.x { background: none; border: 0; color: #b8b09e; font-size: 22px; cursor: pointer; padding: 0 4px; line-height: 1; }

input[type=date], input[type=time] { min-height: 48px; }

.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 14px; overflow: hidden; }
.pth { aspect-ratio: 1; border: 0; padding: 0; background: var(--green-soft) center/cover no-repeat; position: relative; cursor: pointer; }
.pwho { position: absolute; right: 5px; bottom: 5px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; }
.viewer { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; animation: fade .15s; touch-action: pan-y; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.vtop { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--safe-t) + 8px) 12px 8px; color: #ddd; font-size: 14px; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.vbtn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; cursor: pointer; }
.vbot { position: absolute; bottom: 0; left: 0; right: 0; padding: 14px 16px calc(var(--safe-b) + 16px); color: #bbb; font-size: 14px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }

.chip.sug { display: inline-flex; align-items: center; padding: 0; background: var(--amber-soft); border-color: #ecdcb8; overflow: hidden; }
.chip.sug button { background: none; border: 0; padding: 7px 4px 7px 13px; font-size: 14px; cursor: pointer; color: var(--ink); }
.chip.sug small { color: var(--amber); font-size: 11px; margin-left: 4px; }
.chip.sug .sugx { padding: 7px 12px 7px 8px; color: #b9a67e; }
[hidden] { display: none !important; }

/* Inicio (diseño nuevo) */
.hhero { margin: 4px -4px 14px; padding: 18px 18px 16px; border-radius: 26px; background: linear-gradient(150deg, #e4ece3 0%, #f1ebdd 60%, #f6e6dc 100%); border: 1px solid #e1dccd; }
.hhero h1 { font-family: var(--serif); font-size: 30px; line-height: 1.08; margin: 4px 0 0; letter-spacing: -0.02em; }
.hdate { color: var(--muted); font-size: 14px; }
.hdate::first-letter { text-transform: uppercase; }
.wx2 { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 44px; }
.wxi { font-size: 34px; line-height: 1; }
.wxt { font-family: var(--serif); font-size: 36px; font-weight: 600; line-height: 1; }
.wxd { color: var(--muted); font-size: 13px; line-height: 1.3; }
.wxal { margin-top: 10px; background: rgba(255,255,255,.65); border-radius: 14px; padding: 10px 12px; font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.qb { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); text-align: center; }
.qi { position: relative; width: 58px; height: 58px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; font-size: 26px; }
.qi b { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--terra); color: #fff; font-size: 12px; display: grid; place-items: center; }
.domo2 { display: flex; gap: 10px; margin: 14px 0 10px; }
.dcell { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.dbig { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 2px 0 8px; }
.dctl { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dctl button { flex: 1; height: 36px; border-radius: 11px; border: 0; background: var(--green-soft); color: var(--green); font-size: 16px; font-weight: 700; cursor: pointer; }
.dctl span { flex: 1.3; text-align: center; font-weight: 600; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -18px; padding-left: 18px; padding-right: 18px; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll .chip { flex: none; }
.tlist { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tl { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-top: 1px solid var(--line); position: relative; cursor: pointer; }
.tl:first-child { border-top: 0; }
.tl::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.tl.soft { opacity: .72; }
.tl .t { font-weight: 500; }
.tl .s { color: var(--muted); font-size: 13px; margin-top: 1px; }
.tlt { width: 46px; flex: none; text-align: center; font-weight: 700; font-size: 14px; color: var(--c); font-variant-numeric: tabular-nums; }
.tlsep { height: 6px; background: var(--bg); border-top: 1px solid var(--line); }
.shopcard { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.shopcard .t { font-weight: 600; }
.shopcard .s { color: var(--muted); font-size: 13px; }
.tl .grow { flex: 1; min-width: 0; }

/* Pelis y series */
.pgrid2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.poster { display: block; min-width: 0; }
.pimg { aspect-ratio: 2/3; border-radius: 12px; background: #e4dccb center/cover no-repeat; position: relative; display: grid; place-items: center; font-size: 32px; box-shadow: 0 4px 14px rgba(40,30,10,.12); overflow: hidden; }
.plogo { position: absolute; left: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pwho2 { position: absolute; right: 5px; top: 5px; }
.pprog { position: absolute; right: 5px; bottom: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.ptitle { font-size: 13px; font-weight: 600; margin-top: 6px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.psub { font-size: 11px; color: var(--muted); }
.wtop { display: flex; gap: 14px; margin: 6px 0 4px; }
.wposter { width: 120px; flex: none; aspect-ratio: 2/3; border-radius: 14px; background: #e4dccb center/cover no-repeat; display: grid; place-items: center; font-size: 40px; box-shadow: 0 6px 20px rgba(40,30,10,.18); }
.stars { display: flex; gap: 6px; }
.stars button { font-size: 32px; background: none; border: 0; color: #d8cfbc; cursor: pointer; padding: 0 2px; }
.stars button.on { color: #e0a42b; }
