/* Ovotrack — neo-brutalismo de campo */
:root {
  --bg: #f4ecdc; --fg: #2a4a35; --card: #fffaf0; --muted: #5f7364; --line: #2a4a35;
  --yolk: #f5b81c; --yolk-deep: #e08e0b; --terra: #c8502a; --sage: #8fb59a; --sky: #7db4c2;
  --on-accent: #2a4a35; --shadow: 5px 5px 0 var(--line);
  --display: "Fraunces", Georgia, serif; --sans: "Space Grotesk", system-ui, sans-serif;
  --ease: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2a4a35; --fg: #f4ecdc; --card: #345a41; --muted: #c6d3c9; --line: #f4ecdc;
    --shadow: 5px 5px 0 #1a3022;
  }
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh; font: 16px/1.5 var(--sans); background: var(--bg); color: var(--fg);
  overflow-x: hidden;
}
/* paper grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { mix-blend-mode: screen; opacity: .05; } }

main { max-width: 720px; margin: 0 auto; padding: 8px 16px 120px; }
h1, h2, h3 { font-family: var(--display); font-variation-settings: "SOFT" 100, "WONK" 1; line-height: .95; margin: 0; }
h1 { font-size: clamp(2.6rem, 11vw, 4.6rem); font-weight: 800; letter-spacing: -.03em; }
h1 em { font-style: italic; color: var(--terra); }
h2 { font-size: 1.6rem; font-weight: 700; }
a { color: inherit; }
.muted { color: var(--muted); }
code { font-size: .9em; word-break: break-all; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 720px; margin: 0 auto; padding: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font: 800 1.4rem var(--display); text-decoration: none; letter-spacing: -.02em; }
.brand svg { width: 26px; animation: wobble 4s var(--ease) infinite; transform-origin: 50% 90%; }
.date-pill { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; border: 2px solid var(--line); border-radius: 99px; padding: 4px 12px; }

/* bottom nav */
nav.tabs {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 4px; padding: 6px; background: var(--fg); border-radius: 99px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
nav.tabs a {
  display: grid; place-items: center; gap: 2px; width: 72px; padding: 8px 0; border-radius: 99px;
  color: var(--bg); text-decoration: none; font-size: 11px; font-weight: 600; transition: background .3s, color .3s;
}
nav.tabs svg { width: 22px; height: 22px; transition: transform .4s var(--ease); }
nav.tabs a:hover svg { transform: translateY(-3px) rotate(-8deg); }
nav.tabs a[aria-current="page"] { background: var(--yolk); color: var(--on-accent); }

/* cards */
.card {
  position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 20px;
  margin: 18px 0; box-shadow: var(--shadow); transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.reveal { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }

/* forms */
label { display: block; margin: 14px 0; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 14px 16px; font: 500 1rem var(--sans); color: var(--fg);
  background: var(--bg); border: 2px solid var(--line); border-radius: 14px; transition: box-shadow .2s, transform .2s;
}
input::placeholder, textarea::placeholder { color: var(--fg); opacity: .35; font-style: italic; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 4px 4px 0 var(--yolk); transform: translate(-2px, -2px); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px 20px; margin-top: 10px;
  font: 700 1rem var(--sans); text-decoration: none; cursor: pointer; color: var(--on-accent); background: var(--yolk);
  border: 2px solid var(--line); border-radius: 99px; box-shadow: 4px 4px 0 var(--line);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover, button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); }
.btn:active, button:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.ghost { background: transparent; color: var(--fg); }
.danger { background: var(--terra); color: #fff; }
.icon-btn { width: 40px; height: 40px; padding: 0; margin: 0; box-shadow: none; background: transparent; color: var(--fg); }
.icon-btn:hover { box-shadow: 3px 3px 0 var(--line); background: var(--terra); color: #fff; }
.icon-btn svg { width: 18px; }

/* toasts */
.toast {
  position: fixed; top: 16px; left: 50%; z-index: 50; transform: translateX(-50%); width: min(92vw, 480px);
  background: var(--fg); color: var(--bg); padding: 14px 18px; border-radius: 16px; font-weight: 600;
  animation: toast-in .5s var(--ease) both, toast-out .4s ease 4.5s forwards; box-shadow: 4px 4px 0 var(--yolk);
}

/* ---------- auth ---------- */
.marquee { overflow: hidden; border-block: 2px solid var(--line); background: var(--yolk); color: var(--on-accent); margin: 0 -16px; }
.marquee div { display: flex; width: max-content; animation: marquee 28s linear infinite; }
.marquee span { padding: 10px 18px; font: italic 700 1.05rem var(--display); white-space: nowrap; }
.hero { display: grid; place-items: center; text-align: center; padding: 24px 0 8px; }
.hero h1 { margin-top: 12px; }
.hero p { max-width: 32ch; font-size: 1.1rem; }
.big-egg { width: 130px; cursor: pointer; animation: wobble 3s var(--ease) infinite; transform-origin: 50% 90%; background: none; border: 0; box-shadow: none; padding: 0; margin: 0; }
.big-egg:hover { transform: none; box-shadow: none; }
.big-egg .crack, .big-egg .chick { opacity: 0; transition: opacity .3s, transform .6s var(--ease); }
.big-egg .chick { transform: translateY(20px); }
.big-egg.cracked .chick { transform: none; }
.big-egg svg { overflow: visible; }
.big-egg.cracked { animation: shake .5s; }
.big-egg.cracked .crack, .big-egg.cracked .chick { opacity: 1; }
.big-egg.cracked .top { transform: translate(-14px, -30px) rotate(-28deg); }
.big-egg .top { transition: transform .6s var(--ease); transform-origin: 30% 50%; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; font-weight: 600; color: var(--muted); }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--line); opacity: .2; }

/* ---------- batches ---------- */
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 8px 0 4px; }
.count { font: 800 5rem/0.8 var(--display); color: var(--yolk); -webkit-text-stroke: 2px var(--line); }
.batch { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: center; }
.batch:hover { transform: translate(-3px, -3px) rotate(-.4deg); box-shadow: 9px 9px 0 var(--line); }
.egg { width: 96px; transform-origin: 50% 90%; }
.egg .yolk { transform-origin: 50% 100%; transform: scaleY(var(--p)); animation: fill 1.6s var(--ease) both; }
.egg .shine { animation: shine 3s ease-in-out infinite; }
.phase-bloqueo .egg { animation: shake 2.4s ease-in-out infinite; }
.phase-eclosion .egg { animation: shake .9s ease-in-out infinite; }
.phase-eclosion .egg .crack { opacity: 1; }
.egg .crack { opacity: 0; }
.day-big { font: 800 2.8rem/1 var(--display); letter-spacing: -.03em; }
.day-big small { font-size: 1rem; color: var(--muted); font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
.sticker {
  position: absolute; top: -14px; right: 18px; transform: rotate(4deg); padding: 4px 12px; border: 2px solid var(--line);
  border-radius: 99px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--sage); color: #15241a;
  animation: pop .6s var(--ease) both .4s;
}
.phase-bloqueo .sticker { background: var(--terra); color: #fff; }
.phase-eclosion .sticker, .phase-terminada .sticker { background: var(--yolk); }
.phase-programada .sticker { background: var(--sky); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { font-size: .8rem; font-weight: 600; padding: 3px 10px; border: 1.5px solid var(--line); border-radius: 99px; }
.next { margin: 10px 0 0; font-weight: 500; }
.next strong { text-decoration: underline 4px var(--yolk); text-underline-offset: 3px; text-decoration-skip-ink: none; }

.timeline { grid-column: 1 / -1; position: relative; height: 32px; margin: 4px 104px 0 8px; }
.timeline .track { position: absolute; top: 14px; left: 0; right: 0; height: 4px; border-radius: 4px; background: var(--line); opacity: .15; }
.timeline .done { position: absolute; top: 14px; left: 0; height: 4px; border-radius: 4px; background: var(--yolk); width: var(--p); animation: grow 1.6s var(--ease) both; transform-origin: left; }
.timeline .m { position: absolute; top: 8px; width: 16px; height: 16px; margin-left: -8px; border: 2px solid var(--line); border-radius: 50%; background: var(--card); }
.timeline .m.past { background: var(--fg); }
.timeline .m::after {
  content: attr(data-label); position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%) scale(.6); opacity: 0;
  white-space: nowrap; padding: 3px 8px; border-radius: 8px; background: var(--fg); color: var(--bg); font-size: .72rem; font-weight: 600;
  transition: .25s var(--ease); pointer-events: none;
}
.timeline .m:hover::after, .timeline .m:focus::after { opacity: 1; transform: translateX(-50%) scale(1); }
.timeline .now { position: absolute; top: 2px; width: 4px; height: 28px; margin-left: -2px; border-radius: 4px; background: var(--terra); }
.lot {
  display: inline-block; padding: 0 8px; border: 2px solid var(--line); border-radius: 8px; transform: rotate(-4deg);
  background: var(--yolk); color: var(--on-accent); font: 800 .9em var(--display); vertical-align: .08em;
}
.egg-list { grid-column: 1 / -1; margin-right: 96px; }
.egg-list[open] { margin-right: 0; padding-bottom: 44px; }
.egg-list summary { cursor: pointer; font-weight: 700; list-style: none; padding: 6px 0; }
.egg-list summary::before { content: "＋ "; }
.egg-list[open] summary::before { content: "－ "; }
.egg-list ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; padding: 0; margin: 6px 0; list-style: none; }
.egg-list li {
  display: grid; place-items: center; aspect-ratio: 4 / 5; border: 2px solid var(--line); border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  font-size: .72rem; font-weight: 700; background: var(--bg); animation: pop .4s var(--ease) both;
}
.batch-actions { position: absolute; bottom: 12px; right: 12px; }

.empty { text-align: center; padding: 48px 16px; }
.empty svg { width: 120px; animation: wobble 3s var(--ease) infinite; transform-origin: 50% 90%; }

.fab {
  position: fixed; right: max(16px, calc(50% - 344px)); bottom: 92px; z-index: 21; width: 64px; height: 64px; padding: 0; margin: 0;
  border-radius: 50%; font-size: 2rem; line-height: 1; animation: pop .6s var(--ease) both .6s;
}
.fab svg { width: 28px; transition: transform .4s var(--ease); }
.fab:hover svg { transform: rotate(90deg); }

dialog.sheet {
  width: 100%; max-width: 720px; margin: auto auto 0; padding: 24px 20px 32px; border: 2px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; background: var(--card); color: var(--fg); max-height: 92dvh;
}
dialog.sheet[open] { animation: sheet-up .5s var(--ease); }
dialog.sheet::backdrop { background: rgba(26, 48, 34, .55); backdrop-filter: blur(4px); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.preview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 4px; text-align: center;
}
.preview div { border: 2px dashed var(--line); border-radius: 14px; padding: 10px 4px; }
.preview b { display: block; font: 800 1.2rem var(--display); }
.preview small { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.preview .flash-in { animation: pop .4s var(--ease); }

/* egg results */
.st-fertil { --st: var(--sage); }
.st-claro { --st: var(--sky); }
.st-muerto { --st: var(--terra); }
.st-nacido { --st: var(--yolk); }
.tally[hidden] { display: none; }
.tally { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tally .chip { background: var(--st); color: #15241a; }
.tally .chip.st-muerto { color: #fff; }
.tally .rate { background: var(--fg); color: var(--bg); }
.brushes { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 8px 0; }
.brushes legend { font-weight: 600; font-size: .85rem; margin-bottom: 6px; }
.brush {
  display: inline-flex; align-items: center; margin: 0; padding: 6px 12px; border: 2px solid var(--line); border-radius: 99px;
  font-size: .82rem; cursor: pointer; background: var(--st, var(--card)); color: #15241a; transition: transform .2s var(--ease);
}
.brush:not([class*="st-"]) { color: var(--fg); }
.brush.st-muerto { color: #fff; }
.brush input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.brush:has(input:checked) { transform: translateY(-3px) rotate(-3deg); box-shadow: 3px 3px 0 var(--line); outline: 2px solid var(--yolk); outline-offset: 2px; }
.brush:has(input:focus-visible) { outline: 3px solid var(--yolk); }
.egg-list li { display: block; border: 0; background: none; aspect-ratio: auto; animation: none; }
.egg-btn {
  width: 100%; aspect-ratio: 4 / 5; margin: 0; padding: 0; box-shadow: none; font-size: .72rem; font-weight: 700;
  border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: var(--st, var(--bg)); color: #15241a;
  transition: transform .25s var(--ease), background .25s;
}
.egg-btn.st-none { color: var(--fg); }
.egg-btn.st-muerto { color: #fff; }
.egg-btn:hover { box-shadow: none; transform: translateY(-3px) rotate(-6deg); }
.egg-btn.just { animation: shake .45s; }
.edit-btn { position: absolute; bottom: 12px; right: 58px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--line); border-radius: 99px; }
.species-card .edit-btn { right: 58px; }
.copy { display: flex; gap: 8px; }
.copy input { font-size: .8rem; }
.copy button { width: auto; flex: none; margin-top: 6px; }

/* ---------- calendar ---------- */
.month { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 16px; text-transform: capitalize; }
.month h1 { font-size: clamp(2.2rem, 10vw, 3.8rem); text-align: center; }
.month h1 small { display: block; font: 600 1rem var(--sans); color: var(--muted); }
.month a {
  display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 2px solid var(--line); border-radius: 50%;
  text-decoration: none; font-size: 1.4rem; background: var(--card); box-shadow: 3px 3px 0 var(--line); transition: transform .2s var(--ease);
}
.month a:hover { transform: rotate(-10deg) scale(1.08); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.dow { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.day {
  position: relative; aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 0; margin: 0; border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--fg); box-shadow: none;
  font: 700 .95rem var(--sans); animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 14ms);
}
.day:hover { transform: translateY(-2px); box-shadow: 3px 3px 0 var(--line); }
.day.out { opacity: .3; }
.day.today { background: var(--fg); color: var(--bg); }
.day.selected { background: var(--yolk); color: var(--on-accent); transform: scale(1.08) rotate(-3deg); box-shadow: 3px 3px 0 var(--line); }
.dots { display: flex; gap: 2px; height: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line); }
.t-Inicio { background: var(--sage); }
.t-Ovoscopia { background: var(--sky); }
.t-Bloqueo { background: var(--terra); }
.t-Eclosión { background: var(--yolk); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; font-size: .82rem; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.events { list-style: none; padding: 0; margin: 0; }
.events li {
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 2px dashed rgba(127,127,127,.3);
  animation: rise .45s var(--ease) both;
}
.events li[hidden] { display: none; }
.events .d { display: grid; place-items: center; width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 50%; font: 800 1.3rem var(--display); }
.events .what { font-weight: 700; }

.btn svg { width: 20px; }
.howto summary { cursor: pointer; font-weight: 700; margin-top: 14px; }
.howto ul { padding-left: 1.2rem; }
.howto li { margin: 6px 0; }

/* ---------- species ---------- */
.species-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; align-items: center; }
.species-card:hover { transform: translate(-3px, -3px) rotate(.4deg); box-shadow: 9px 9px 0 var(--line); }
.species-days { grid-row: span 3; font: 800 3.4rem/1 var(--display); color: var(--yolk); -webkit-text-stroke: 2px var(--line); min-width: 2ch; text-align: center; }
.species-days small { display: block; font: 700 .7rem var(--sans); -webkit-text-stroke: 0; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.bar { height: 10px; border: 2px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--w); background: repeating-linear-gradient(-45deg, var(--yolk) 0 8px, var(--yolk-deep) 8px 16px); animation: grow 1.2s var(--ease) both; transform-origin: left; }

/* origin stickers on species, switch */
.origin-base { background: var(--card); color: var(--fg); }
.origin-mine { background: var(--yolk); }
.origin-community { background: var(--sky); }
.switch { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.switch input {
  appearance: none; flex: none; width: 52px; height: 30px; margin: 2px 0 0; padding: 0; border-radius: 99px; position: relative; cursor: pointer;
  background: var(--bg); transition: background .3s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 50%;
  background: var(--card); transition: transform .35s var(--ease);
}
.switch input:checked { background: var(--yolk); }
.switch input:checked::after { transform: translateX(22px); }
.switch input:focus-visible { box-shadow: 4px 4px 0 var(--yolk); }

/* ---------- account ---------- */
.qr svg { width: 200px; height: 200px; background: #fff; padding: 10px; border: 2px solid var(--line); border-radius: 16px; }
.otp { font: 800 1.6rem var(--display); letter-spacing: .4em; text-align: center; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes pop { from { opacity: 0; transform: scale(.3) rotate(-20deg); } }
@keyframes fill { from { transform: scaleY(0); } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes wobble { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-9deg); } 84% { transform: rotate(7deg); } 92% { transform: rotate(-3deg); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-6deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
@keyframes shine { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -30px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -30px); visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal, .day, .events li, .sticker, .fab, .egg .yolk, .timeline .done, .bar i { animation: none !important; }
}
