:root {
  --pink: #ff4f8b;
  --pink-d: #d6306b;
  --orange: #ff9f1c;
  --orange-d: #d97d00;
  --green: #2ec95c;
  --green-d: #1f9c44;
  --blue: #3a86ff;
  --blue-d: #1d62d1;
  --yellow: #ffd23f;
  --yellow-d: #e0ad00;
  --purple: #8e5cff;
  --school: #3aaa35;
  --ink: #2b2147;
  --card: #ffffff;
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
/* el color de fondo de html pinta TODA la pantalla, también bajo la barra del iPhone */
html { background: #c2b8f0; }
body {
  font-family: "Fredoka", "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }

/* burbujas de fondo */
.bg-bubbles {
  position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; bottom: auto;
  pointer-events: none; z-index: 0; overflow: hidden;
  background: linear-gradient(160deg, #ffe66d 0%, #ffb3d1 45%, #a0c4ff 100%);
}
.bg-bubbles span {
  position: absolute; bottom: -120px; border-radius: 50%;
  background: rgba(255,255,255,.35);
  animation: rise 14s linear infinite;
}
.bg-bubbles span:nth-child(1) { left: 6%;  width: 80px;  height: 80px;  animation-duration: 16s; }
.bg-bubbles span:nth-child(2) { left: 24%; width: 40px;  height: 40px;  animation-duration: 11s; animation-delay: 3s; }
.bg-bubbles span:nth-child(3) { left: 48%; width: 110px; height: 110px; animation-duration: 19s; animation-delay: 1s; }
.bg-bubbles span:nth-child(4) { left: 68%; width: 55px;  height: 55px;  animation-duration: 13s; animation-delay: 5s; }
.bg-bubbles span:nth-child(5) { left: 84%; width: 90px;  height: 90px;  animation-duration: 17s; animation-delay: 2s; }
.bg-bubbles span:nth-child(6) { left: 36%; width: 30px;  height: 30px;  animation-duration: 10s; animation-delay: 7s; }
@keyframes rise { to { transform: translateY(-120vh) rotate(360deg); } }

/* pantallas */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: none; flex-direction: column;
  padding: calc(12px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; animation: pop-in .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

/* ===== botones grandes 3D ===== */
.big-btn {
  --c: var(--green); --d: var(--green-d);
  display: flex; align-items: center; justify-content: center; gap: 16px;
  width: 100%; min-height: 96px; padding: 14px 22px;
  border-radius: var(--radius);
  background: var(--c);
  color: #fff; font-size: clamp(26px, 7vw, 40px); font-weight: 700; line-height: 1.05;
  text-shadow: 0 3px 0 rgba(0,0,0,.18);
  box-shadow: 0 8px 0 var(--d), 0 14px 24px rgba(0,0,0,.18);
  transition: transform .08s, box-shadow .08s;
  text-align: left;
}
.big-btn .ico { font-size: 1.5em; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.big-btn:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 var(--d), 0 4px 10px rgba(0,0,0,.2); }
.big-btn:disabled { filter: grayscale(.8); opacity: .55; }
.big-btn.green  { --c: var(--green);  --d: var(--green-d); }
.big-btn.orange { --c: var(--orange); --d: var(--orange-d); }
.big-btn.blue   { --c: var(--blue);   --d: var(--blue-d); }
.big-btn.pink   { --c: var(--pink);   --d: var(--pink-d); }
.big-btn.purple { --c: var(--purple); --d: #6a3ad6; }
.big-btn.small  { min-height: 72px; font-size: 28px; width: auto; margin: 10px auto 0; }

.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 60px; padding: 10px 22px; border-radius: 999px;
  background: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 5px 0 rgba(43,33,71,.18), 0 8px 16px rgba(0,0,0,.08);
  transition: transform .08s;
}
.pill-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(43,33,71,.18); }
.pill-btn.ok { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-d); }
.pill-btn.danger-bg { background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-d); }
.link-btn { margin: 18px auto 0; font-size: 20px; padding: 10px; text-decoration: underline; }
.link-btn.danger { color: var(--pink-d); }

/* ===== INICIO ===== */
#screen-home { align-items: center; justify-content: center; gap: 18px; }
.home-head { text-align: center; }
.logo-cart {
  font-size: 84px; line-height: 1;
  animation: cart-drive 2.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.12));
}
@keyframes cart-drive {
  0%,100% { transform: translateX(-14px) rotate(-4deg); }
  50% { transform: translateX(14px) rotate(4deg); }
}
.home-head h1 {
  margin: 4px 0 0; font-size: clamp(46px, 13vw, 72px); line-height: .9; font-weight: 700;
  color: #fff; letter-spacing: 1px;
  text-shadow: 0 5px 0 var(--pink), 0 10px 0 rgba(0,0,0,.12);
}
.home-head h1 span { color: var(--yellow); text-shadow: 0 5px 0 var(--orange-d), 0 10px 0 rgba(0,0,0,.12); }
.school {
  display: inline-flex; align-items: center; gap: 10px; margin: 14px 0 0; padding: 4px 18px;
  border-radius: 999px; background: #fff; text-align: left;
  font-size: 18px; line-height: 1.05; color: var(--school);
  box-shadow: 0 5px 0 rgba(58,170,53,.35);
}
.school img { display: block; height: 64px; width: auto; }

.level-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 520px; padding: 12px 18px;
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 6px 0 rgba(43,33,71,.15);
}
.level-badge {
  flex: none; width: 70px; height: 70px; border-radius: 50%;
  display: grid; place-items: center; font-size: 42px;
  background: radial-gradient(circle at 35% 30%, #fff6c2, var(--yellow));
  box-shadow: inset 0 -5px 0 var(--yellow-d);
}
.level-badge.up { animation: badge-up .8s cubic-bezier(.2,1.6,.4,1); }
@keyframes badge-up { 0% { transform: scale(.3) rotate(-90deg); } 100% { transform: none; } }
.level-info { flex: 1; min-width: 0; }
.level-name { font-size: 22px; color: var(--purple); }
.level-bar { height: 16px; margin: 6px 0 4px; border-radius: 99px; background: #eee6ff; overflow: hidden; }
#level-fill {
  height: 100%; width: 0; border-radius: 99px;
  background: repeating-linear-gradient(45deg, var(--purple) 0 12px, #a97dff 12px 24px);
  transition: width .6s cubic-bezier(.2,1.2,.4,1);
}
.level-stars { display: flex; gap: 14px; font-size: 19px; }
.level-stars b { font-weight: 700; }

.home-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 520px; padding-bottom: 10px; }
.home-buttons .big-btn {
  flex-direction: column; gap: 4px; min-height: 150px; padding: 12px 8px;
  text-align: center; font-size: clamp(22px, 6vw, 32px);
}
.home-buttons .big-btn .ico { font-size: 1.7em; }

/* ===== barra superior ===== */
.top-bar {
  --c: var(--pink);
  display: flex; align-items: center; gap: 10px;
  margin: 0 -4px 14px; padding: 8px 10px; border-radius: 24px;
  background: var(--c); color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.15);
  flex: none;
}
.top-bar.green { --c: var(--green); }
.top-bar.orange { --c: var(--orange); }
.top-bar.blue { --c: var(--blue); }
.top-bar.purple { --c: var(--purple); }
.top-bar h2 { flex: 1; margin: 0; text-align: center; font-size: clamp(26px, 7vw, 36px); text-shadow: 0 3px 0 rgba(0,0,0,.15); }
.back, .round-btn, .top-bar .spacer, .count-chip {
  flex: none; width: 60px; height: 60px; border-radius: 50%;
  display: grid; place-items: center; font-size: 30px;
}
.back, .round-btn { background: rgba(255,255,255,.28); }
.back:active, .round-btn:active { transform: scale(.9); }
.count-chip { background: #fff; color: var(--blue-d); font-size: 26px; }

/* ===== escáner ===== */
.scanner-box {
  position: relative; width: 100%; max-width: 520px; margin: 0 auto;
  aspect-ratio: 4 / 3; max-height: 34vh;
  border-radius: var(--radius); overflow: hidden;
  background: #2b2147;
  border: 6px solid #fff;
  box-shadow: 0 8px 0 rgba(43,33,71,.2);
}
.reader { position: absolute; inset: 0; }
.reader video { width: 100% !important; height: 100% !important; object-fit: cover; display: block; }
.reader > div, .reader canvas, .reader img { display: none !important; }
.reader > video { display: block !important; }
.scan-line {
  position: absolute; left: 8%; right: 8%; top: 50%; height: 5px; border-radius: 9px;
  background: #ff3b3b; box-shadow: 0 0 14px 4px rgba(255,59,59,.7);
  animation: scan 1.6s ease-in-out infinite;
}
@keyframes scan { 0%,100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }
.scan-hint {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  white-space: nowrap; padding: 4px 14px; border-radius: 99px;
  background: rgba(0,0,0,.5); color: #fff; font-size: 18px;
}
.scanner-box.ok { animation: flash-ok .5s; }
@keyframes flash-ok { 0% { border-color: var(--green); box-shadow: 0 0 0 10px rgba(46,201,92,.5); } 100% { border-color: #fff; } }
.scanner-box.off .scan-line, .scanner-box.off .scan-hint { display: none; }
.scanner-box .cam-msg {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 16px; color: #fff; font-size: 20px;
}
.scan-col { display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ===== VENDER ===== */
.sell-layout { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.cart-col { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.cart {
  list-style: none; margin: 0; padding: 4px; flex: 1; min-height: 120px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.cart li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 22px; background: #fff;
  box-shadow: 0 5px 0 rgba(43,33,71,.12);
  animation: slide-in .4s cubic-bezier(.2,1.5,.4,1);
}
@keyframes slide-in { from { transform: translateX(60px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.cart .thumb, .product-card .thumb {
  flex: none; width: 60px; height: 60px; border-radius: 16px;
  display: grid; place-items: center; font-size: 40px; background: #fff4d6; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart .name { flex: 1; min-width: 0; font-size: 22px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.cart .qty { font-size: 20px; color: var(--purple); }
.cart .price { font-size: 32px; font-weight: 700; color: var(--green-d); }
.cart .del { width: 48px; height: 48px; border-radius: 50%; background: #ffe3ec; font-size: 22px; flex: none; }
.cart .del:active { transform: scale(.85); }
.cart-empty { text-align: center; font-size: 22px; padding: 10px; opacity: .85; }
.cart-empty .bounce { font-size: 70px; animation: bob 1.4s ease-in-out infinite; }
.cart-empty p { margin: 6px 0; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

.total-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 22px; border-radius: var(--radius);
  background: var(--yellow); box-shadow: 0 6px 0 var(--yellow-d);
  flex: none;
}
.total-label { font-size: 28px; }
.total-amount { font-size: clamp(52px, 16vw, 84px); font-weight: 700; line-height: 1; }
.total-amount.bump { animation: bump .4s; }
@keyframes bump { 40% { transform: scale(1.25) rotate(-4deg); color: var(--pink); } }
.pay-btn { flex: none; }

/* ===== COBRAR ===== */
.pay-body { display: flex; flex-direction: column; gap: 14px; max-width: 720px; width: 100%; margin: 0 auto; }
.pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-box { padding: 10px; border-radius: var(--radius); text-align: center; background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.15); }
.pay-box.yellow { background: var(--yellow); box-shadow: 0 6px 0 var(--yellow-d); }
.pay-box.blue { background: #cfe0ff; box-shadow: 0 6px 0 #9dbcf3; }
.pay-label { font-size: 18px; letter-spacing: .5px; }
.pay-num { font-size: clamp(46px, 13vw, 76px); font-weight: 700; line-height: 1.05; }
.pay-q { margin: 4px 0 0; text-align: center; font-size: 22px; }
.bills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bill {
  position: relative; height: 84px; border-radius: 14px;
  font-size: 34px; font-weight: 700; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  box-shadow: 0 6px 0 rgba(0,0,0,.2);
  border: 4px dashed rgba(255,255,255,.6);
  transition: transform .08s;
}
.bill::after { content: "💵"; position: absolute; top: 4px; right: 8px; font-size: 18px; opacity: .7; }
.bill.coin { border-radius: 50%; width: 84px; justify-self: center; border-style: solid; }
.bill.coin::after { content: ""; }
.bill:active { transform: translateY(5px) scale(.96); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.pay-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.change-box {
  text-align: center; padding: 10px; border-radius: var(--radius);
  background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.15);
}
.change-box.need { background: #ffe3ec; }
.change-box.need .pay-num { font-size: clamp(30px, 8vw, 44px); color: var(--pink-d); }
.change-box.ok { background: #d5f7df; animation: bump .5s; }
.change-coins { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.change-coins span { padding: 4px 12px; border-radius: 10px; color: #fff; font-size: 20px; }

/* ===== NUEVO ===== */
#screen-add .add-step { display: flex; flex-direction: column; gap: 14px; max-width: 620px; width: 100%; margin: 0 auto; align-items: stretch; }
#add-step-scan { align-items: center; }
.step-title { display: flex; align-items: center; gap: 10px; font-size: 26px; }
.step-num {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--purple); color: #fff; font-size: 24px; box-shadow: 0 4px 0 #6a3ad6;
}
.code-chip {
  align-self: center; padding: 6px 16px; border-radius: 99px; background: #fff;
  font-size: 18px; letter-spacing: 1px; box-shadow: 0 3px 0 rgba(43,33,71,.15);
}
.product-preview { display: flex; gap: 12px; align-items: center; }
.pic {
  flex: none; width: 92px; height: 92px; border-radius: 24px; background: #fff;
  display: grid; place-items: center; font-size: 60px; overflow: hidden;
  box-shadow: 0 6px 0 rgba(43,33,71,.15);
}
.pic img { width: 100%; height: 100%; object-fit: cover; }
.big-input {
  flex: 1; min-width: 0; height: 92px; padding: 0 18px; border-radius: 24px;
  border: 4px solid #fff; outline: none; background: #fff;
  font-size: 32px; font-weight: 700; color: var(--ink); text-transform: uppercase;
  box-shadow: 0 6px 0 rgba(43,33,71,.15);
  user-select: text; -webkit-user-select: text;
}
.big-input:focus { border-color: var(--purple); }
.big-input::placeholder { color: #c4bcd9; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.emoji-grid button {
  height: 58px; border-radius: 16px; font-size: 34px; background: rgba(255,255,255,.75);
}
.emoji-grid button.sel { background: var(--yellow); box-shadow: 0 0 0 4px var(--orange) inset; transform: scale(1.08); }
.photo-btn { align-self: center; }
.price-picker { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pm {
  width: 84px; height: 84px; border-radius: 50%; font-size: 40px;
  background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.18);
}
.pm:active { transform: translateY(5px); box-shadow: 0 1px 0 rgba(43,33,71,.18); }
.price-show {
  min-width: 180px; text-align: center; padding: 4px 20px; border-radius: var(--radius);
  background: var(--yellow); box-shadow: 0 6px 0 var(--yellow-d);
  font-size: 72px; font-weight: 700; line-height: 1.1;
}
.price-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.price-chips button {
  min-width: 70px; height: 56px; border-radius: 99px; background: #fff; font-size: 24px;
  box-shadow: 0 4px 0 rgba(43,33,71,.15);
}
.price-chips button.sel { background: var(--purple); color: #fff; }

/* ===== LISTA ===== */
.list-body { display: flex; flex-direction: column; gap: 16px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.product-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px;
  border-radius: 24px; background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.15);
  text-align: center;
}
.product-card:active { transform: translateY(4px); }
.product-card .thumb { width: 84px; height: 84px; font-size: 58px; }
.product-card .name { font-size: 20px; line-height: 1.1; word-break: break-word; }
.product-card .price {
  font-size: 32px; font-weight: 700; color: #fff; background: var(--green);
  padding: 0 16px; border-radius: 99px;
}
.grownups { margin-top: 10px; padding: 12px 16px; border-radius: 20px; background: rgba(255,255,255,.6); font-size: 18px; }
.grownups summary { font-size: 20px; cursor: pointer; }
.grownups p { font-weight: 500; }
.grown-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.grown-btns .pill-btn { font-size: 18px; min-height: 50px; }

/* ===== MODALES ===== */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(43,33,71,.55); backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: 100%; max-width: 440px; padding: 22px; border-radius: 32px;
  background: #fff; text-align: center; display: flex; flex-direction: column; gap: 14px;
  animation: pop-in .3s cubic-bezier(.2,1.5,.4,1);
}
.modal-title { font-size: 28px; line-height: 1.15; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-actions.col { flex-direction: column; }
.modal-actions .pill-btn { flex: 1; }
.big-emoji { font-size: 80px; line-height: 1; }
.wobble { animation: wobble 1s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotate(-10deg); } 50% { transform: rotate(10deg); } }
.keypad-display {
  min-height: 64px; padding: 8px 14px; border-radius: 18px; background: #f2edff;
  font-size: 36px; letter-spacing: 3px; word-break: break-all;
}
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  height: 70px; border-radius: 20px; font-size: 36px; background: #fff4d6;
  box-shadow: 0 5px 0 #f0d58f;
}
.keypad button:active { transform: translateY(4px); box-shadow: 0 1px 0 #f0d58f; }

/* ===== efectos ===== */
.toast {
  position: fixed; left: 50%; top: calc(20px + var(--safe-top)); z-index: 70;
  transform: translate(-50%, -150%); transition: transform .35s cubic-bezier(.2,1.5,.4,1);
  padding: 12px 24px; border-radius: 99px; background: var(--ink); color: #fff;
  font-size: 22px; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); }
.flyer {
  position: fixed; left: 50%; top: 40%; z-index: 60; pointer-events: none;
  font-size: 90px; opacity: 0; transform: translate(-50%, -50%);
}
.flyer.go { animation: fly 0.9s ease-out; }
@keyframes fly {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
  30% { opacity: 1; transform: translate(-50%, -60%) scale(1.3) rotate(-10deg); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(.8) rotate(10deg); }
}
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }

/* ===== sílabas (lectura) ===== */
.syl:nth-child(odd) { color: var(--blue-d); }
.syl:nth-child(even) { color: var(--pink-d); }
.word + .word { margin-left: .35em; }
.syl.lit { background: var(--yellow); border-radius: 8px; }
.cart .name, .product-card .name { cursor: pointer; }
.cart .name::after, .product-card .name::after { content: " 🔊"; font-size: .7em; opacity: .55; }

/* ===== cobrar por pasos ===== */
.pay-step { display: flex; flex-direction: column; gap: 14px; }
.pay-step.slide { animation: pop-in .35s cubic-bezier(.2,1.4,.4,1); }
.change-box.go { background: #d5f7df; }
.q-title { text-align: center; font-size: clamp(26px, 7vw, 34px); line-height: 1.15; }
.q-title b { color: var(--green-d); }
.equation {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 12px; border-radius: var(--radius); background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.15);
}
.eq-n { padding: 4px 14px; border-radius: 18px; font-size: clamp(36px, 10vw, 54px); font-weight: 700; }
.eq-n.blue { background: #cfe0ff; }
.eq-n.yellow { background: var(--yellow); }
.eq-op { font-size: clamp(36px, 10vw, 54px); color: var(--purple); }
.eq-ans {
  min-width: 110px; text-align: center; padding: 4px 14px; border-radius: 18px;
  border: 5px dashed var(--purple); font-size: clamp(36px, 10vw, 54px); font-weight: 700; color: var(--purple);
}
.eq-ans.ok { border-style: solid; border-color: var(--green); background: #d5f7df; color: var(--green-d); }
.eq-ans.bad { animation: shake .45s; border-color: var(--pink); color: var(--pink-d); }
@keyframes shake { 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }
.hint {
  padding: 12px 16px; border-radius: 22px; background: #fff4d6; text-align: center; font-size: 22px; line-height: 1.3;
}
.hint .jumps { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.hint .jumps span {
  min-width: 40px; padding: 4px 6px; border-radius: 12px; background: var(--purple); color: #fff; font-size: 18px;
  animation: pop-in .3s backwards;
}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad button {
  height: 72px; border-radius: 20px; font-size: 38px; background: #fff;
  box-shadow: 0 5px 0 rgba(43,33,71,.18);
}
.numpad button:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(43,33,71,.18); }
.numpad .go-key { background: var(--green); color: #fff; box-shadow: 0 5px 0 var(--green-d); }
.mic { align-self: center; background: var(--pink); color: #fff; box-shadow: 0 5px 0 var(--pink-d); }
.mic.listening { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(255,79,139,.25); } }
.give-tray {
  min-height: 90px; padding: 10px; border-radius: var(--radius); background: rgba(255,255,255,.7);
  border: 4px dashed #fff; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
}
.give-tray.bad { animation: shake .45s; border-color: var(--pink); }
.tray-empty { font-size: 20px; opacity: .7; }
.give-tray .bill { height: 60px; min-width: 76px; font-size: 26px; padding: 0 10px; animation: pop-in .25s; }
.give-tray .bill.coin { width: 60px; min-width: 60px; padding: 0; }
.give-tray .bill::after { display: none; }
.give-sum { text-align: center; font-size: 28px; }
.give-sum b { font-size: 40px; color: var(--purple); }
.done-card {
  text-align: center; padding: 18px; border-radius: var(--radius); background: #fff;
  box-shadow: 0 6px 0 rgba(43,33,71,.15);
}
.done-card .bounce { animation: bob 1.4s ease-in-out infinite; }
.done-msg { font-size: clamp(28px, 7vw, 38px); line-height: 1.15; }
.done-stars { margin-top: 8px; font-size: 22px; line-height: 1.5; }

/* ===== letras ===== */
.tabs { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; flex: none; }
.tabs button {
  flex: 1; max-width: 240px; height: 60px; border-radius: 99px; background: rgba(255,255,255,.6);
  font-size: 24px; font-weight: 700;
}
.tabs button.sel { background: #fff; color: var(--purple); box-shadow: 0 5px 0 rgba(43,33,71,.18); }
.w-body { display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: 680px; width: 100%; margin: 0 auto; }
.w-pic {
  width: 150px; height: 150px; border-radius: 36px; background: #fff; display: grid; place-items: center;
  font-size: 104px; overflow: hidden; box-shadow: 0 8px 0 rgba(43,33,71,.15);
  animation: bob 2s ease-in-out infinite;
}
.w-pic img { width: 100%; height: 100%; object-fit: cover; }
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.slot {
  width: clamp(44px, 10vw, 64px); height: clamp(58px, 13vw, 80px); border-radius: 16px;
  display: grid; place-items: center; background: #fff; border-bottom: 6px solid #d9cff5;
  font-size: clamp(32px, 8vw, 48px); font-weight: 700; color: #d9cff5;
}
.slot.next { border-bottom-color: var(--purple); animation: bob 1s ease-in-out infinite; }
.slot.filled { color: var(--ink); border-bottom-color: var(--green); animation: pop-in .3s; }
.slot.space { background: none; border: 0; width: 18px; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tile {
  width: clamp(56px, 13vw, 76px); height: clamp(56px, 13vw, 76px); border-radius: 18px;
  font-size: clamp(32px, 8vw, 44px); font-weight: 700; color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.2);
}
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.tile.bad { animation: shake .45s; }
.tile.used { visibility: hidden; }
.read-word {
  padding: 14px 26px; border-radius: var(--radius); background: #fff; box-shadow: 0 6px 0 rgba(43,33,71,.15);
  font-size: clamp(44px, 12vw, 72px); font-weight: 700; letter-spacing: 2px;
}
.read-word::after { content: " 🔊"; font-size: .45em; vertical-align: middle; }
.r-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.r-options button {
  aspect-ratio: 1; border-radius: 28px; background: #fff; font-size: clamp(56px, 16vw, 96px);
  box-shadow: 0 6px 0 rgba(43,33,71,.15); overflow: hidden; display: grid; place-items: center;
}
.r-options button img { width: 100%; height: 100%; object-fit: cover; }
.r-options button.bad { animation: shake .45s; background: #ffe3ec; }
.r-options button.ok { background: #d5f7df; box-shadow: 0 0 0 6px var(--green); }

/* =====================================================
   TODO EN UNA PANTALLA (sin scroll): tamaños según el alto
   ===================================================== */
.screen {
  height: 100vh; height: 100dvh; bottom: auto;
  padding: calc(10px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
  gap: clamp(8px, 1.6dvh, 14px);
}
.screen > * { flex: none; }
.top-bar { margin: 0 -4px; padding: 6px 10px; }
.back, .round-btn, .top-bar .spacer, .count-chip { width: clamp(48px, 7dvh, 60px); height: clamp(48px, 7dvh, 60px); font-size: clamp(24px, 3.6dvh, 30px); }
.top-bar h2 { font-size: clamp(24px, 4.2dvh, 36px); }
.big-btn { min-height: clamp(62px, 10dvh, 96px); padding: 8px 18px; font-size: clamp(24px, 4.4dvh, 40px); }
.pill-btn { min-height: clamp(48px, 6.8dvh, 60px); font-size: clamp(18px, 2.7dvh, 22px); padding: 6px 20px; }

/* inicio */
#screen-home { justify-content: flex-start; align-items: center; }
.home-head { display: flex; flex-direction: column; align-items: center; }
.logo-cart { font-size: clamp(36px, 7dvh, 84px); }
.home-head h1 { font-size: clamp(34px, min(13vw, 6.4dvh), 72px); }
.school { margin-top: clamp(6px, 1.4dvh, 14px); }
.school img { height: clamp(40px, 6.5dvh, 64px); }
.level-card { padding: clamp(6px, 1.2dvh, 12px) 16px; text-align: left; position: relative; }
.level-card:active { transform: translateY(4px); }
.level-badge { width: clamp(50px, 7.5dvh, 70px); height: clamp(50px, 7.5dvh, 70px); font-size: clamp(30px, 4.6dvh, 42px); }
.seller-name { font-size: clamp(18px, 2.8dvh, 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.level-name { font-size: clamp(15px, 2.2dvh, 20px); }
.level-bar { height: clamp(10px, 1.6dvh, 16px); margin: 4px 0; }
.level-stars { font-size: clamp(15px, 2.2dvh, 19px); }
.trophy { font-size: 32px; flex: none; animation: bob 2s ease-in-out infinite; }
.home-buttons { flex: 1 1 auto; min-height: 0; grid-template-rows: 1fr 1fr; padding-bottom: 6px; }
.home-buttons .big-btn { min-height: 0; height: 100%; font-size: clamp(20px, min(6vw, 3.8dvh), 34px); }
.home-buttons .big-btn .ico { font-size: 1.6em; }

/* vender */
.sell-layout, .cart-col { flex: 1 1 auto; min-height: 0; }
.sell-layout { gap: clamp(8px, 1.4dvh, 14px); }
.scan-col { gap: 8px; }
.scanner-box { max-height: 28dvh; }
.cart { min-height: 0; }
.cart-empty { font-size: clamp(17px, 2.5dvh, 22px); padding: 4px; }
.cart-empty .bounce { font-size: clamp(40px, 7dvh, 70px); }
.total-bar { padding: 4px 20px; }
.total-amount { font-size: clamp(40px, 8dvh, 84px); }
.total-label { font-size: clamp(22px, 3.4dvh, 28px); }

/* cobrar */
.pay-body { flex: 1 1 auto; min-height: 0; gap: clamp(8px, 1.4dvh, 14px); }
.pay-body:not([data-step="receive"]) .pay-row { display: none; }
.pay-step { flex: 1 1 auto; min-height: 0; gap: clamp(8px, 1.4dvh, 14px); }
.pay-box { padding: 6px; }
.pay-label { font-size: clamp(14px, 2dvh, 18px); }
.pay-num { font-size: clamp(34px, 6.5dvh, 76px); }
.pay-q { font-size: clamp(17px, 2.6dvh, 22px); margin: 0; }
.bills { gap: clamp(8px, 1.4dvh, 12px); }
.bill { height: clamp(52px, 8.5dvh, 84px); font-size: clamp(24px, 4dvh, 34px); }
.bill.coin { width: clamp(52px, 8.5dvh, 84px); }
.change-box { padding: 6px; }
.change-box.need .pay-num, .change-box .pay-num { font-size: clamp(28px, 5dvh, 44px); }
#pay-next, #pay-done { margin-top: auto; }
.q-title { font-size: clamp(22px, 4dvh, 34px); }
.eq-n, .eq-op, .eq-ans { font-size: clamp(28px, 6dvh, 54px); }
.equation { padding: clamp(6px, 1.2dvh, 12px); }
.hint { font-size: clamp(17px, 2.6dvh, 22px); padding: 8px 14px; }
.numpad { gap: clamp(6px, 1.2dvh, 10px); }
.numpad button { height: clamp(48px, 8dvh, 72px); font-size: clamp(28px, 4.6dvh, 38px); }
.give-tray { min-height: clamp(64px, 11dvh, 90px); }
.give-sum { font-size: clamp(22px, 3.4dvh, 28px); }
.give-sum b { font-size: clamp(30px, 5dvh, 40px); }
.done-card { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }

/* nuevo producto */
#screen-add .add-step { flex: 1 1 auto; min-height: 0; gap: clamp(8px, 1.4dvh, 14px); }
#add-step-scan { justify-content: center; }
.step-title { font-size: clamp(20px, 3.4dvh, 26px); }
.pic { width: clamp(64px, 10dvh, 92px); height: clamp(64px, 10dvh, 92px); font-size: clamp(42px, 6.5dvh, 60px); }
.big-input { height: clamp(64px, 10dvh, 92px); font-size: clamp(24px, 4dvh, 32px); }
.emoji-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; padding: 4px; }
.emoji-grid button { height: clamp(46px, 7dvh, 58px); font-size: clamp(28px, 4.4dvh, 34px); }
.add-foot { display: flex; gap: 12px; align-items: center; justify-content: center; }
.add-foot .big-btn { flex: 1; }
#add-step-price #add-save { margin-top: auto; }
.product-preview.center { justify-content: center; }
.add-name2 { font-size: clamp(28px, 5dvh, 44px); }
.pm { width: clamp(64px, 10dvh, 84px); height: clamp(64px, 10dvh, 84px); }
.price-show { font-size: clamp(48px, 9dvh, 72px); }
.price-chips button { height: clamp(46px, 6.5dvh, 56px); }

/* lista */
.list-body { flex: 1 1 auto; min-height: 0; gap: 10px; }
.product-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; padding: 4px 4px 10px; }
.grownups { margin-top: 0; flex: none; max-height: 45dvh; overflow-y: auto; }

/* letras */
.tabs { margin: 0; }
.tabs button { height: clamp(48px, 7dvh, 60px); font-size: clamp(19px, 3dvh, 24px); }
.w-body { flex: 1 1 auto; min-height: 0; gap: clamp(8px, 1.6dvh, 16px); justify-content: space-evenly; }
.w-pic { width: clamp(84px, 17dvh, 150px); height: clamp(84px, 17dvh, 150px); font-size: clamp(56px, 11dvh, 104px); }
.slot { width: clamp(38px, min(10vw, 7dvh), 64px); height: clamp(50px, min(13vw, 9dvh), 80px); font-size: clamp(28px, min(8vw, 5.4dvh), 48px); }
.tile { width: clamp(48px, min(13vw, 8.5dvh), 76px); height: clamp(48px, min(13vw, 8.5dvh), 76px); font-size: clamp(28px, min(8vw, 5dvh), 44px); }
.read-word { font-size: clamp(38px, min(12vw, 8dvh), 72px); }
.r-options { max-width: min(100%, 60dvh); }

/* cajeros */
.top-bar.yellow { --c: var(--orange); }
.ranking {
  list-style: none; margin: 0; padding: 4px; flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 720px; align-self: center;
}
.ranking li {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 24px;
  background: #fff; box-shadow: 0 5px 0 rgba(43,33,71,.12);
}
.ranking li.me { box-shadow: 0 0 0 4px var(--purple), 0 5px 0 rgba(43,33,71,.12); }
.ranking .pos { width: 40px; text-align: center; font-size: 30px; flex: none; }
.ranking .av { font-size: 44px; flex: none; }
.ranking .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ranking .nm { font-size: 26px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .lv { font-size: 17px; color: var(--purple); }
.ranking .pts { display: flex; flex-direction: column; align-items: flex-end; font-size: 17px; flex: none; }

/* ¿quién vende? */
.modal-card { max-height: calc(100dvh - 32px); }
.seller-card { max-width: 560px; padding: 18px; }
.seller-pane { display: flex; flex-direction: column; gap: clamp(8px, 1.4dvh, 14px); min-height: 0; }
.seller-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px;
  overflow-y: auto; max-height: 52dvh; padding: 4px;
}
.seller-chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 22px;
  background: #f4f0ff; box-shadow: 0 4px 0 #ddd3fb;
}
.seller-chip.me { background: #fff6c2; box-shadow: 0 0 0 4px var(--yellow), 0 4px 0 var(--yellow-d); }
.seller-chip:active { transform: translateY(3px); }
.seller-chip .av { font-size: 44px; line-height: 1.1; }
.seller-chip .nm { font-size: 20px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seller-chip .lv { font-size: 18px; }
.avatar-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.avatar-row button { flex: none; width: 52px; height: 52px; border-radius: 50%; font-size: 32px; background: #f4f0ff; }
.avatar-row button.sel { background: var(--yellow); box-shadow: 0 0 0 4px var(--orange); }
.name-show {
  min-height: 60px; padding: 6px 12px; border-radius: 18px; background: #f2edff;
  font-size: clamp(30px, 5dvh, 40px); letter-spacing: 3px; color: var(--purple);
}
.name-show .ph { color: #c4bcd9; letter-spacing: 1px; }
.abc { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.abc button {
  height: clamp(40px, 6.2dvh, 54px); border-radius: 12px; background: #fff4d6; box-shadow: 0 4px 0 #f0d58f;
  font-size: clamp(20px, 3.4dvh, 28px); font-weight: 700;
}
.abc button:active { transform: translateY(3px); box-shadow: 0 1px 0 #f0d58f; }
.abc button.wide { grid-column: span 1; background: #ffe3ec; box-shadow: 0 4px 0 #f5b5c9; }

/* ===== tablet horizontal ===== */
@media (min-width: 820px) and (orientation: landscape) {
  #screen-home.active {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: 1fr auto;
    column-gap: 32px; align-items: center; padding-left: 32px; padding-right: 32px;
  }
  .home-head { grid-column: 1; grid-row: 1; }
  .level-card { grid-column: 1; grid-row: 2; max-width: none; margin-bottom: 8px; }
  .home-buttons { grid-column: 2; grid-row: 1 / span 2; height: 100%; max-width: none; padding: 8px 0; }
  .sell-layout { flex-direction: row; align-items: stretch; }
  .scan-col { width: 44%; justify-content: center; }
  .scanner-box { max-height: none; }
  .pay-body { max-width: 980px; }
  .pay-step#pay-step-receive { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: auto 1fr auto auto; column-gap: 20px; }
  #pay-step-receive.hidden { display: none !important; }
  #pay-step-receive .pay-q { grid-column: 1; }
  #pay-step-receive .bills { grid-column: 1; grid-row: 2 / span 3; align-content: center; }
  #pay-step-receive .pay-actions, #pay-step-receive .change-box, #pay-step-receive #pay-next { grid-column: 2; }
  #pay-step-receive .pay-actions { grid-row: 1 / span 2; align-self: end; }
}
/* teléfono horizontal: poco alto */
@media (max-height: 520px) {
  .logo-cart, .school { display: none; }
}

/* avisos abajo: arriba los tapa el desenfoque de la barra del iPhone */
.toast {
  top: auto; bottom: calc(18px + var(--safe-bottom));
  transform: translate(-50%, 180%);
  white-space: normal; text-align: center; width: max-content; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25); border: 3px solid #fff;
}
.toast.show { transform: translate(-50%, 0); }
.school { padding: 0 10px; border-radius: 22px; }
.school img { height: clamp(52px, 9dvh, 90px); }
.modal { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal-card { min-width: 0; }
.seller-pane, .avatar-row, .abc { min-width: 0; max-width: 100%; }
/* el teclado numérico se achica para dejar lugar a la pista */
.numpad { flex: 1 1 auto; min-height: 0; grid-auto-rows: minmax(40px, 1fr); max-height: calc(4 * 72px + 30px); }
.numpad button { height: auto; }
.w-pic { width: clamp(84px, 22dvh, 200px); height: clamp(84px, 22dvh, 200px); font-size: clamp(56px, 15dvh, 140px); }
.tile { width: clamp(50px, min(15vw, 10dvh), 92px); height: clamp(50px, min(15vw, 10dvh), 92px); font-size: clamp(30px, min(9vw, 6dvh), 54px); }
.slot { width: clamp(40px, min(11vw, 8dvh), 72px); height: clamp(52px, min(14vw, 10dvh), 90px); font-size: clamp(30px, min(9vw, 6dvh), 54px); }
.numpad, .equation, .hint, .give-tray, #give-bills, .done-card { width: 100%; max-width: 600px; align-self: center; }
.pay-body { max-width: 760px; }
@media (min-width: 820px) and (orientation: landscape) {
  .home-head h1 { font-size: clamp(48px, 10dvh, 110px); }
  .logo-cart { font-size: clamp(56px, 11dvh, 110px); }
  .school img { height: clamp(60px, 12dvh, 120px); }
}

/* la voz está cargando ⏳ o hablando 🔊 */
.loading { position: relative; opacity: .75; }
.loading::before {
  content: "⏳"; position: absolute; top: -10px; right: -6px; font-size: 22px;
  animation: wobble .8s ease-in-out infinite;
}
.talking { animation: pulse 1s infinite; }
