/* =====================================================================
   CESTY — Componentes base (prototipo) v1.1
   Cesti · Depósito · Odómetro · Botones · Chips · Corte
   Todo consume tokens semánticos: cambia de tema sin tocar nada aquí.
   ---------------------------------------------------------------------
   v1.1
   · Foco de teclado visible en todo lo pulsable (sin romper los cortes).
   · Hover solo en dispositivos con puntero: no se queda "pegado" al tocar.
   · Estado deshabilitado en botones.
   · Contraste del chip de acento corregido (lila sobre lila claro no llegaba).
   · Animaciones en pausa cuando su vista está oculta (batería).
   · Movimiento reducido completo: odómetro, oleaje, salpicadura, pop.
   · Utilidades que app.js ya usa: .sr-only, hoja arrastrable, campo inválido.
   · Modo de alto contraste forzado (forced-colors).
   ===================================================================== */

@property --p {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

/* ───────── Utilidades ───────── */
/* `hidden` siempre oculta, aunque el componente declare su propio display */
[hidden] { display: none !important; }
.cut {
  --c: var(--cut-brand);
  clip-path: polygon(var(--c) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)),
      calc(100% - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
}
.cut-card {
  --c: var(--cut-card);
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
}
.ico { display: block; flex: none; }
[data-icon] { display: inline-grid; place-items: center; }

/* Solo para lectores de pantalla (región viva del escáner) */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Foco de teclado. :where() deja la especificidad en 0: cualquier regla propia gana. */
:where(button, a[href], input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
/* El recorte (.cut) y los contenedores con overflow cortarían el anillo por fuera: va por dentro */
.cut:focus-visible,
.lrow-in:focus-visible,
.dock .tab:focus-visible { outline-offset: -4px; }
/* Las vistas y la hoja reciben el foco por código al abrirse; no necesitan marco */
.view:focus, .bsheet:focus, .detail:focus { outline: none; }

/* ───────── Botones ───────── */
.btn {
  --h: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--h);
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-control);
  font: 700 var(--fs-body-lg)/1 var(--font-ui);
  letter-spacing: -.01em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;          /* sin retardo de doble toque */
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard), opacity var(--dur-fast), filter var(--dur-fast);
}
.btn:active { transform: scale(.96); transition-duration: var(--dur-instant); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.btn--primary { --h: var(--tap-primary); background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.btn--primary:active { box-shadow: 0 6px 14px -8px rgba(255, 77, 61, .6); }
.btn--ghost { background: var(--surface-sunken); color: var(--text); }
.btn--ink { background: var(--surface-inverse); color: var(--text-inverse); }
.btn--sm { --h: 40px; padding: 0 16px; font-size: var(--fs-label); }
.btn--block { width: 100%; }

/* Hover solo con puntero real: en táctil se quedaría "pegado" tras el toque */
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--brand-press); }
  .btn--ink:hover { filter: brightness(1.08); }
  .btn--ghost:hover { background: color-mix(in srgb, var(--surface-sunken) 86%, var(--text) 14%); }
  .iconbtn:hover { box-shadow: var(--shadow-2); }
}

/* Deshabilitado: se ve apagado y no responde */
.btn:disabled, .btn[aria-disabled="true"],
.iconbtn:disabled, .iconbtn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
  filter: none;
  pointer-events: none;
}

.iconbtn {
  width: var(--tap-min);
  height: var(--tap-min);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-base) var(--ease-standard);
}
.iconbtn:active { transform: scale(.92); }

/* ───────── Chips ───────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-chip);
  font: 700 var(--fs-label)/1 var(--font-ui);
  background: var(--surface-sunken);
  color: var(--text-2);
  white-space: nowrap;
  transition: background-color var(--dur-slow) var(--ease-standard), color var(--dur-slow) var(--ease-standard);
}
.chip--ok { background: var(--ok-soft); color: var(--ok-ink); }
.chip--warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip--over { background: var(--over-soft); color: var(--over-ink); }
/* Lila sobre lila claro no llega a contraste AA: el texto usa la versión oscura */
:root { --chip-accent-ink: var(--lilac-700); }
[data-theme="oscuro"] { --chip-accent-ink: var(--accent); }
.chip--accent { background: var(--accent-soft); color: var(--chip-accent-ink); }
.chip .ico, .chip [data-icon] { flex: none; }

/* ───────── Tile de producto ───────── */
.tile {
  --tile-bg: var(--surface-sunken);
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  border-radius: var(--radius-tile);
  background: var(--tile-bg);
  user-select: none;
}
[data-theme="oscuro"] .tile { background: var(--surface-sunken); }

/* ───────── Odómetro ───────── */
.odo {
  display: inline-flex;
  align-items: flex-start;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  vertical-align: bottom;
}
.odo-d { display: inline-block; height: 1em; overflow: hidden; }
.odo-strip {
  display: flex;
  flex-direction: column;
  transition: transform 760ms var(--ease-spring);
}
.odo-strip > span { height: 1em; line-height: 1; text-align: center; }
.odo-s { display: inline-block; height: 1em; line-height: 1; }

/* ───────── Vuelo y partículas ───────── */
.fly-x, .fly-y { position: absolute; left: 0; top: 0; pointer-events: none; z-index: var(--z-toast); }
.fly-chip {
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-chip);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font: 800 15px/1 var(--font-ui);
  white-space: nowrap;
  box-shadow: var(--shadow-3);
  font-variant-numeric: tabular-nums;
}
.particle {
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: var(--z-toast);
}

/* =====================================================================
   CESTI · mascota (v12)
   Más vida, menos peluche: se llena contigo, mira, se inclina y guiña.
   ===================================================================== */
.cesti { width: 100%; height: 100%; display: block; overflow: visible; transform-origin: 50% 90%; --es: 1; }
.cesti .c-shadow { fill: var(--cesti-shadow); transform-box: fill-box; transform-origin: center; animation: c-shadow 2.6s var(--ease-inout) infinite; }
.cesti .c-all { transform-box: fill-box; transform-origin: 50% 100%; animation: c-bob 2.6s var(--ease-inout) infinite; transition: rotate var(--dur-slow) var(--ease-spring), scale var(--dur-slow) var(--ease-spring); }
.cesti .c-handle-g { transform-box: fill-box; transform-origin: 50% 100%; transition: transform var(--dur-slow) var(--ease-spring); }
.cesti .c-handle { fill: none; stroke: var(--cesti-line); stroke-width: 9; stroke-linecap: square; stroke-linejoin: miter; transition: stroke var(--dur-slow); }
.cesti .c-wheel { fill: var(--cesti-line); transition: fill var(--dur-slow); }
.cesti .c-hub { fill: var(--cesti-hub); }
.cesti .c-body { fill: var(--cesti-body); }
.cesti .c-slots { fill: var(--cesti-mesh); opacity: .32; }
.cesti .c-shade { fill: var(--cesti-mesh); opacity: .18; }
.cesti .c-inner { fill: var(--cesti-mesh); fill: color-mix(in srgb, var(--cesti-mesh) 70%, #000); stroke: var(--cesti-line); stroke-width: 2.5; stroke-linejoin: round; transition: stroke var(--dur-slow); }
.cesti .c-back { fill: var(--cesti-mesh); fill: color-mix(in srgb, var(--cesti-mesh) 78%, var(--cesti-body)); }
.cesti .c-rim { fill: var(--cesti-line); stroke: var(--cesti-line); stroke-width: 2.5; transition: fill var(--dur-slow), stroke var(--dur-slow); }
.cesti .c-item { stroke: var(--cesti-line); stroke-width: 3; stroke-linejoin: round; transition: stroke var(--dur-slow); }
.cesti .c-item--1 { fill: var(--cesti-item-1); }
.cesti .c-item--2 { fill: var(--cesti-item-2); }
.cesti .c-item-line { fill: none; stroke: var(--cesti-line); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.cesti .c-label { fill: #fff; }
.cesti .c-cap { fill: #fff; stroke: var(--cesti-line); stroke-width: 2.5; stroke-linejoin: round; transition: stroke var(--dur-slow); }
.cesti .c-drop { fill: var(--cesti-item-2); stroke: var(--cesti-ink); stroke-width: 1.5; stroke-linejoin: round; }
.cesti .c-carton { fill: #fff; stroke: var(--cesti-line); stroke-width: 2.5; stroke-linejoin: round; transition: stroke var(--dur-slow); }
.cesti .c-band { fill: var(--cesti-item-3); }
.cesti .c-cheek { fill: var(--cesti-cheek); }
.cesti .c-ink { fill: var(--cesti-ink); }
.cesti .c-glint { fill: #fff; }
.cesti .c-glint--s { opacity: .85; }
.cesti .c-mouth { stroke: var(--cesti-ink); stroke-width: 1.6; stroke-linejoin: round; }
/* Mejillas siempre (la calidez de la cara), más o menos encendidas según el ánimo */
.cesti .c-cheeks { opacity: .75; transition: opacity var(--dur-fast) var(--ease-standard); }
.cesti[data-mood="joy"] .c-cheeks { opacity: 1; }
.cesti[data-mood="alert"] .c-cheeks, .cesti[data-mood="sleep"] .c-cheeks { opacity: .5; }
.cesti[data-mood="worried"] .c-cheeks { opacity: .35; }
.cesti .c-line { fill: none; stroke: var(--cesti-ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.cesti .c-tongue { fill: #FF8A7A; }
.cesti .c-sweat { fill: var(--sky-300); }
.cesti .c-spark { fill: var(--butter-500); }
.cesti .c-bang { fill: var(--butter-500); stroke: var(--cesti-line); stroke-width: 2; }
.cesti .c-zzz { fill: var(--cesti-line); font: 800 17px var(--font-display); }
.cesti .c-eyes { transform-box: fill-box; transform-origin: center; animation: c-blink 4.4s infinite; }
.cesti .c-eyes-in { transform-box: fill-box; transform-origin: center; transform: scale(var(--es)); transition: transform 140ms var(--ease-standard); }
.cesti .c-eye { transform-box: fill-box; transform-origin: center; }

/* Lo que lleva dentro: 0 vacía · 1 botella · 2 + barra de pan · 3 + brik.
   Al aparecer, cada producto cae desde arriba con muelle (entra en la cesta). */
.cesti .c-it { transition: opacity var(--dur-fast) var(--ease-standard), translate 620ms var(--ease-spring); }
.cesti[data-fill="0"] .c-it,
.cesti[data-fill="1"] .c-it:is([data-n="2"], [data-n="3"]),
.cesti[data-fill="2"] .c-it[data-n="3"] { opacity: 0; translate: 0 -18px; transition-duration: var(--dur-fast), 0s; }

/* La mirada: hacia algo concreto si se le pide; si no, en reposo echa vistazos */
.cesti .c-look { transition: translate 280ms var(--ease-standard); }
.cesti[data-mood="happy"]:not([data-look]) .c-look { animation: c-glance 9s var(--ease-inout) infinite; }
.cesti[data-look="up"] .c-look { translate: 0 -2.6px; }
.cesti[data-look="down"] .c-look { translate: 0 2px; }
.cesti[data-look="left"] .c-look { translate: -2.6px 0; }
.cesti[data-look="right"] .c-look { translate: 2.6px 0; }

/* Guiño al tocarlo */
.cesti.is-wink .c-eye--l { animation: c-wink 460ms var(--ease-standard); }

/* Accesorios y variantes */
.cesti .c-acc { stroke: var(--cesti-line); stroke-width: 2.5; stroke-linejoin: round; transition: stroke var(--dur-slow); }
.cesti .c-acc--1 { fill: var(--cesti-item-1); }
.cesti .c-acc--2 { fill: var(--cesti-item-2); }
.cesti .c-acc--ink { fill: var(--cesti-ink); stroke: none; }
.cesti .c-tagtxt { fill: var(--cesti-ink); font: 800 11px var(--font-display); text-anchor: middle; }
.cesti--mini .c-wheel, .cesti--mini .c-hub { display: none; }
.cesti--mono .c-body { stroke: var(--cesti-line); stroke-width: 4; }
.cesti--mono .c-shade { display: none; }
.cesti--lite .c-handle { stroke-width: 11; }

/* Estados de ánimo: cada pieza declara en qué estados es visible */
.cesti [data-m] { opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.cesti[data-mood="happy"] [data-m~="happy"],
.cesti[data-mood="alert"] [data-m~="alert"],
.cesti[data-mood="worried"] [data-m~="worried"],
.cesti[data-mood="joy"] [data-m~="joy"],
.cesti[data-mood="sleep"] [data-m~="sleep"] { opacity: 1; }

/* El cuerpo también habla: el asa hace de brazos y la cesta se inclina o se encoge */
.cesti[data-mood="alert"] { --es: 1.14; }
.cesti[data-mood="alert"] .c-all { rotate: -4deg; animation: c-bob 1.3s var(--ease-inout) infinite; }
.cesti[data-mood="alert"] .c-handle-g { transform: translateY(-4px); }
.cesti[data-mood="alert"] .c-brow-up { transform-box: fill-box; transform-origin: 0% 100%; animation: c-brow 620ms var(--ease-elastic) both; }
.cesti[data-mood="alert"] .c-bang { transform-box: fill-box; transform-origin: 50% 100%; animation: c-bang 600ms var(--ease-elastic) both; }

.cesti[data-mood="worried"] .c-all { scale: .96; animation: c-tremble 2.2s var(--ease-standard) infinite; }
.cesti[data-mood="worried"] .c-handle-g { transform: rotate(-5deg); }
.cesti[data-mood="worried"] .c-sweat { transform-box: fill-box; transform-origin: top; animation: c-drip 2.2s var(--ease-inout) infinite; }

.cesti[data-mood="joy"] .c-handle-g { animation: c-wave .9s var(--ease-inout) infinite alternate; }
.cesti[data-mood="joy"] .c-items { animation: c-hop .9s var(--ease-standard) .08s infinite; }
.cesti[data-mood="joy"] .c-all { animation: c-jump .9s var(--ease-standard) infinite; }
.cesti[data-mood="joy"] .c-shadow { animation: c-shadow-jump .9s var(--ease-standard) infinite; }
.cesti[data-mood="joy"] .c-spark { transform-box: fill-box; transform-origin: center; animation: c-twinkle .9s var(--ease-inout) infinite alternate; }
.cesti[data-mood="joy"] .c-spark:nth-child(2) { animation-delay: .3s; }
.cesti[data-mood="joy"] .c-spark:nth-child(3) { animation-delay: .6s; }

.cesti[data-mood="sleep"] .c-handle-g { transform: translateY(5px) scaleY(.9); }
.cesti[data-mood="sleep"] .c-all { animation: c-breathe 3.6s var(--ease-inout) infinite; }
.cesti[data-mood="sleep"] .c-eyes { animation: none; }
.cesti[data-mood="sleep"] .c-zzz text { animation: c-z 2.4s var(--ease-standard) infinite; }
.cesti[data-mood="sleep"] .c-zzz text:nth-child(2) { animation-delay: 1.2s; }

.cesti.is-pop { animation: c-pop 520ms var(--ease-elastic); }
.cesti.is-catch { animation: c-catch 420ms var(--ease-spring); }

@keyframes c-wave { from { transform: rotate(-5deg) translateY(-2px); } to { transform: rotate(5deg) translateY(-2px); } }
@keyframes c-hop { 0%, 100% { transform: translateY(0); } 40%, 60% { transform: translateY(-6px); } }
@keyframes c-bang { 0% { transform: scale(0) rotate(-14deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes c-brow { 0% { transform: translateY(3px) rotate(6deg); } 100% { transform: none; } }
@keyframes c-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes c-shadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.88); opacity: .7; } }
@keyframes c-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
@keyframes c-wink { 0%, 100% { transform: scaleY(1); } 25%, 65% { transform: scaleY(.1); } }
@keyframes c-glance { 0%, 36%, 100% { translate: 0 0; } 40%, 50% { translate: -1.6px .3px; } 54%, 64% { translate: 1.6px -.2px; } 68% { translate: 0 0; } }
@keyframes c-jump {
  0% { transform: translateY(0) scale(1.06, .94); }
  14% { transform: translateY(0) scale(1.12, .86); }
  40% { transform: translateY(-16px) scale(.94, 1.08); }
  58% { transform: translateY(-18px) scale(1, 1); }
  84% { transform: translateY(0) scale(1.08, .92); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes c-shadow-jump { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.55); opacity: .4; } }
@keyframes c-tremble {
  0%, 55%, 100% { transform: rotate(0); }
  60% { transform: rotate(-3deg); }
  66% { transform: rotate(3deg); }
  72% { transform: rotate(-2deg); }
  78% { transform: rotate(1.5deg); }
  84% { transform: rotate(0); }
}
@keyframes c-drip { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(3px) scale(1.1); } }
@keyframes c-twinkle { from { transform: scale(.6) rotate(0); opacity: .5; } to { transform: scale(1.15) rotate(25deg); opacity: 1; } }
@keyframes c-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975); } }
@keyframes c-z { 0% { opacity: 0; transform: translate(0, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -10px); } }
@keyframes c-pop { 0% { transform: scale(.86); } 100% { transform: scale(1); } }
@keyframes c-catch { 0% { transform: scale(1, 1); } 35% { transform: scale(1.14, .84); } 70% { transform: scale(.96, 1.05); } 100% { transform: scale(1, 1); } }

/* =====================================================================
   DEPÓSITO (BudgetTank 2.0)
   ===================================================================== */
.tank {
  --level: .3;
  --liquid: var(--tank-ok);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 272px;
  background: var(--tank-bg);
  color: var(--tank-text);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
}
.tank.cut { box-shadow: none; }
.tank[data-state="warn"] { --liquid: var(--tank-warn); }
.tank[data-state="over"] { --liquid: var(--tank-over); }

.tank__liquid {
  position: absolute;
  inset: 0;
  z-index: 0;
  transform: translateY(calc((1 - var(--level)) * 100%));
  transition: transform var(--dur-story) var(--ease-spring-soft);
}
.tank.no-anim .tank__liquid, .tank.no-anim .tank__body, .tank.no-anim .tank__wave { transition: none !important; }

.tank__body {
  position: absolute;
  inset: 0;
  background-color: var(--liquid);
  opacity: var(--liquid-opacity);
  transition: background-color 700ms var(--ease-standard);
}
.tank[data-state="over"] .tank__body {
  background-image: repeating-linear-gradient(-45deg, transparent 0 12px, rgba(0, 0, 0, .09) 12px 24px);
  background-size: 34px 34px;
  animation: tank-stripes 1.2s linear infinite;
}
@keyframes tank-stripes { to { background-position: 34px 0; } }

.tank__surface {
  position: absolute;
  left: 0;
  right: 0;
  top: -15px;
  height: 17px;
  transform-origin: 50% 100%;
  overflow: visible;
}
.tank__surface--back { top: -21px; height: 23px; }
.tank__wave {
  position: absolute;
  left: 0;
  top: 0;
  width: 200%;
  height: 100%;
  fill: var(--liquid);
  transition: fill 700ms var(--ease-standard);
  animation: tank-wave 3.4s linear infinite;
}
.tank__wave path.line { fill: none; stroke: var(--liquid); stroke-width: 2.2; opacity: var(--liquid-line-opacity); vector-effect: non-scaling-stroke; transition: stroke 700ms; }
.tank__surface--front .tank__wave path.fill { opacity: var(--liquid-opacity); }
.tank__surface--back .tank__wave { opacity: calc(var(--liquid-opacity) * .45); animation-duration: 5.8s; animation-direction: reverse; }
[data-theme="oscuro"] .tank__surface--front .tank__wave { filter: drop-shadow(0 0 6px var(--liquid)); }
@keyframes tank-wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.tank.is-slosh .tank__surface { animation: tank-slosh 1100ms var(--ease-standard); }
.tank.is-slosh .tank__surface--back { animation-delay: 70ms; }
@keyframes tank-slosh {
  0% { transform: scaleY(1); }
  14% { transform: scaleY(2.6); }
  36% { transform: scaleY(.5); }
  60% { transform: scaleY(1.6); }
  82% { transform: scaleY(.85); }
  100% { transform: scaleY(1); }
}

.tank__buddy {
  position: absolute;
  right: 20px;
  top: -40px;
  width: 54px;
  height: 54px;
  animation: buddy-float 3.2s var(--ease-inout) infinite;
}
.tank__buddy .c-shadow { display: none; }
.tank.is-slosh .tank__buddy { animation: buddy-hop 900ms var(--ease-standard), buddy-float 3.2s 900ms var(--ease-inout) infinite; }
@keyframes buddy-float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(3px) rotate(4deg); } }
@keyframes buddy-hop { 0% { transform: translateY(0); } 25% { transform: translateY(-16px) rotate(-8deg); } 55% { transform: translateY(4px) rotate(5deg); } 100% { transform: translateY(0) rotate(-4deg); } }

.tank__mark {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--at) * 100%);
  height: 0;
  border-top: 2px dashed var(--tank-mark);
  z-index: 2;
  pointer-events: none;
}
.tank__mark span {
  position: absolute;
  right: 86px;
  bottom: 4px;
  font: 700 var(--fs-caption)/1 var(--font-ui);
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--tank-text);
  opacity: .72;
}
.tank__mark--max { border-top-style: solid; border-top-width: 2px; }
.tank__mark--max span { opacity: .9; }

.tank__content {
  position: relative;
  z-index: 3;
  height: 100%;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.tank__label { font: 700 var(--fs-label)/1 var(--font-ui); text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.tank__total {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  font-size: calc(var(--fs-hero) * var(--display-scale));
  line-height: 1;
}
.tank__cur { font-size: .45em; margin-top: .12em; opacity: .75; }
.tank__of { margin-top: 8px; font: 600 var(--fs-body)/1.2 var(--font-ui); opacity: .72; }
.tank__left { margin-top: auto; height: 36px; padding: 0 14px; font-size: var(--fs-body); }
.tank[data-state="ok"] .tank__left { background: var(--surface); color: var(--ok-ink); box-shadow: var(--shadow-1); }
.tank[data-state="warn"] .tank__left { background: var(--surface); color: var(--warn-ink); box-shadow: var(--shadow-1); }
.tank[data-state="over"] .tank__left { background: var(--surface-inverse); color: var(--text-inverse); }
[data-theme="oscuro"] .tank[data-state] .tank__left { background: var(--surface-2); color: var(--liquid); box-shadow: inset 0 0 0 1px var(--border-strong); }


.cut, .tank.cut { border-radius: var(--radius-cut); }

/* =====================================================================
   ESTADOS QUE ACTIVA app.js
   ===================================================================== */

/* Hoja inferior arrastrable: mientras el dedo la lleva, sin transición (si no, iría con retraso) */
.sheet-layer.on .bsheet.is-dragging { transition: none; }
.bsheet .grab, .bsheet .bs-head { touch-action: none; cursor: grab; }
.bsheet.is-dragging .grab, .bsheet.is-dragging .bs-head { cursor: grabbing; }

/* Código postal incompleto */
.cp:has(input[aria-invalid="true"]) { box-shadow: 0 0 0 3px var(--over); }
.cp input[aria-invalid="true"] { color: var(--over-ink); }

/* =====================================================================
   RENDIMIENTO · lo que no se ve no se anima
   Las vistas ocultas siguen en el DOM; sus bucles infinitos (oleaje, mascota,
   rayas del exceso) gastarían batería sin que nadie los vea.
   ===================================================================== */
.view:not(.on) :is(.cesti, .cesti *, .tank__wave, .tank__surface, .tank__buddy, .tank__body) {
  animation-play-state: paused;
}

/* =====================================================================
   MOVIMIENTO REDUCIDO
   Los tokens de duración ya valen 1 ms; aquí van los valores fijos y las
   animaciones en bucle, que no pasan por tokens.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .cesti, .cesti *, .tank__wave, .tank__surface, .tank__buddy, .tank__body { animation: none !important; }
  .odo-strip { transition-duration: 1ms; }
  .cesti .c-eyes-in { transition-duration: 1ms; }
}

/* =====================================================================
   ALTO CONTRASTE FORZADO (Windows)
   El sistema sustituye los colores: los bordes sustituyen a los rellenos.
   ===================================================================== */
@media (forced-colors: active) {
  .btn, .iconbtn, .chip, .tank { border: 1px solid ButtonText; }
  .btn:disabled, .btn[aria-disabled="true"] { border-color: GrayText; color: GrayText; }
  .tank__body, .tank__wave, .tank__liquid { forced-color-adjust: none; }
  :where(button, a[href], input, [tabindex]):focus-visible { outline-color: Highlight; }
}
