:root {
  --sky: #80c7e8;
  --sage: #a8c8a0;
  --cream: #fff4df;
  --yellow: #f5c96a;
  --yellow-d: #dcac48;
  --coral: #ed9b83;
  --coral-d: #d77f66;
  --deep: #29475b;
  --white: #fffdf8;
  --ink: #29475b;
  --ink-2: rgba(41, 71, 91, 0.68);
  --line: rgba(41, 71, 91, 0.1);
  --good: #6fa565;
  /* Colores institucionales de J. García López (jgarcialopez.com.mx) */
  --brand: #0f1e6a;
  --brand-2: #1a2e8a;
  --brand-accent: #b0842a;
  --brand-gold: #f7be00;
  --brand-paper: #f8f6f3;
  --sky-top: #9fd3ec;
  --sky-bot: #eaf5ef;
  --radius: 26px;
  --shadow: 0 18px 50px rgba(41, 71, 91, 0.22);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 78%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
.ico { width: 1.2em; height: 1.2em; flex: none; vertical-align: middle; }

/* ------------------------------------------------------------ botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 800 17px/1.1 'Nunito', sans-serif; color: var(--deep);
  min-height: 52px; padding: 14px 24px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--white); text-decoration: none;
  box-shadow: 0 4px 0 rgba(41, 71, 91, 0.14), 0 10px 22px rgba(41, 71, 91, 0.12);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.2s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(41, 71, 91, 0.14), 0 4px 10px rgba(41, 71, 91, 0.12); }
.btn:focus-visible, .chip:focus-visible, .member:focus-visible { outline: 3px solid var(--deep); outline-offset: 3px; }
.btn.primary { background: var(--yellow); box-shadow: 0 4px 0 var(--yellow-d), 0 12px 26px rgba(220, 172, 72, 0.35); }
.btn.primary:active { box-shadow: 0 1px 0 var(--yellow-d), 0 4px 10px rgba(220, 172, 72, 0.3); }
.btn.big { font-size: 19px; min-height: 58px; padding: 16px 34px; border-radius: 20px; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--cream); box-shadow: none; }
.btn:disabled, .btn[aria-disabled='true'] { filter: grayscale(0.6); opacity: 0.6; cursor: not-allowed; }
.btn.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 14px; cursor: pointer; color: var(--deep); background: transparent;
}
.icon-btn .ico { width: 22px; height: 22px; }
.icon-btn.ghost { background: var(--cream); }

.coin {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%; flex: none; vertical-align: -5px;
  background: radial-gradient(circle at 35% 32%, #ffe7a6 0 22%, var(--yellow) 23% 62%, var(--yellow-d) 63%);
  box-shadow: inset 0 -2px 0 rgba(150, 100, 20, 0.25);
}
.coin.sm { width: 17px; height: 17px; vertical-align: -3px; }

.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ------------------------------------------------------------ loader */
.loader {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: linear-gradient(180deg, #9fd3ec, #eaf5ef); z-index: 50; transition: opacity 0.6s;
  font-weight: 700; color: var(--ink-2); text-align: center; padding: 24px;
}
.loader.done { opacity: 0; pointer-events: none; }
.loader-dot { width: 46px; height: 46px; border-radius: 50%; background: var(--yellow); animation: bob 0.9s ease-in-out infinite alternate; box-shadow: 0 10px 20px rgba(220, 172, 72, 0.4); }
@keyframes bob { to { transform: translateY(-14px) scale(1.05); } }

/* ------------------------------------------------------------ pantallas */
.screen { position: absolute; inset: 0; z-index: 20; }
.title-screen {
  display: flex; align-items: flex-end; justify-content: center;
  padding: 24px 16px calc(32px + var(--safe-b));
  background: linear-gradient(180deg, rgba(255, 253, 248, 0) 35%, rgba(255, 253, 248, 0.82) 75%);
}
.title-wrap { text-align: center; max-width: 520px; animation: rise 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.emblem {
  width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 22px; display: grid; place-items: center;
  background: var(--deep); color: var(--yellow); box-shadow: 0 10px 24px rgba(41, 71, 91, 0.3);
}
.emblem .ico { width: 34px; height: 34px; }
.kicker { margin: 0; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; font-size: 14px; color: var(--coral-d); }
h1 { margin: 2px 0 12px; font-size: clamp(44px, 12vw, 76px); line-height: 0.95; font-weight: 900; letter-spacing: -0.02em; color: var(--deep); }
.tagline { margin: 0 0 22px; font-size: 18px; line-height: 1.4; color: var(--ink-2); }
.tagline strong { color: var(--deep); }
.meta { margin: 14px 0 0; font-size: 14px; font-weight: 700; color: var(--ink-2); }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } }

.setup-screen { display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(16px + var(--safe-b)); }
.setup-card { width: 100%; max-width: 480px; padding: 22px 20px 20px; animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; max-height: calc(100% - 20px); overflow: auto; }
.setup-card h2 { margin: 2px 0 14px; font-size: 26px; font-weight: 900; }
.step { margin: 0; font-size: 13px; font-weight: 800; color: var(--coral-d); text-transform: uppercase; letter-spacing: 0.1em; }
.field { display: grid; gap: 6px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.field input {
  font: 800 18px 'Nunito', sans-serif; color: var(--deep); padding: 12px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--cream); outline: none; user-select: text;
}
.field input:focus { border-color: var(--sky); }
.field-label { margin: 16px 0 8px; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.member {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 12px 6px 10px;
  border: 2px solid var(--line); border-radius: 18px; background: var(--white); cursor: pointer;
  font-family: inherit; color: var(--deep); transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.member:active { transform: scale(0.96); }
.member.on { border-color: var(--sage); background: #f2f8ef; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 4px;
  background: var(--c); color: var(--white); font-weight: 900; font-size: 19px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.1);
  opacity: 0.45; transition: opacity 0.15s;
}
.member.on .avatar { opacity: 1; }
.m-name { font-weight: 900; font-size: 15px; }
.m-role { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.m-check {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--good); color: #fff; opacity: 0; transform: scale(0.5); transition: 0.15s;
}
.m-check .ico { width: 13px; height: 13px; stroke-width: 3; }
.member.on .m-check { opacity: 1; transform: none; }
.setup-note { margin: 10px 0 14px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.setup-note.warn { color: var(--coral-d); }

/* ------------------------------------------------------------ HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: calc(12px + var(--safe-t)) 16px 0; pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 16px;
  background: rgba(255, 253, 248, 0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(41, 71, 91, 0.14); font-weight: 900; font-size: 16px;
}
.pill.icon-btn { width: 44px; padding: 0; justify-content: center; }
.year-pill { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; font-size: 14px; }
.dots { display: flex; gap: 4px; }
.dots i { width: 14px; height: 5px; border-radius: 3px; background: var(--line); }
.dots i.done { background: var(--sage); }
.dots i.now { background: var(--coral); }
.coin-pill b { font-size: 19px; min-width: 18px; }
.pill small { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.tranq-col { display: grid; gap: 3px; }
.coin-pill.bump { animation: bump 0.4s; }
@keyframes bump { 40% { transform: scale(1.15); } }
.tranq-ico { color: var(--coral); display: grid; }
.tranq-bar { width: 64px; height: 9px; border-radius: 6px; background: var(--line); overflow: hidden; }
.tranq-bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--coral), var(--yellow), var(--sage)); background-size: 120px 100%; transition: width 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }

.float-num {
  position: fixed; z-index: 60; transform: translateX(-50%); font-weight: 900; font-size: 18px; pointer-events: none;
  animation: floatUp 1.3s ease-out forwards; text-shadow: 0 2px 0 var(--white);
}
.float-num.up { color: var(--good); }
.float-num.down { color: var(--coral-d); }
@keyframes floatUp { from { opacity: 0; margin-top: 0; } 15% { opacity: 1; } to { opacity: 0; margin-top: 34px; } }

/* ------------------------------------------------------------ chips sobre objetos */
.chips { position: absolute; inset: 0; z-index: 5; pointer-events: none; transition: opacity 0.3s; }
.chips.dim { opacity: 0.25; }
.chips.dim .chip { pointer-events: none; }
.chip {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  display: grid; justify-items: center; gap: 3px; padding: 0; border: 0; background: none; font: inherit;
  will-change: transform;
}
.chip-ico {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--white); color: var(--deep); box-shadow: 0 6px 16px rgba(41, 71, 91, 0.22);
  border: 3px solid var(--white); transition: background 0.2s, transform 0.2s;
}
.chip-ico .ico { width: 22px; height: 22px; }
.chip.can .chip-ico { background: var(--yellow); border-color: #fff3cf; animation: chipPulse 1.6s ease-in-out infinite; }
.chip.max .chip-ico { background: var(--sage); color: var(--white); border-color: #e3f0de; }
@keyframes chipPulse { 50% { transform: translateY(-4px); box-shadow: 0 12px 22px rgba(220, 172, 72, 0.45); } }
.pips { display: flex; gap: 3px; padding: 3px 5px; border-radius: 8px; background: rgba(255, 253, 248, 0.92); }
.pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.pips i.on { background: var(--good); }
.pips.big { background: none; padding: 0; margin-right: 6px; }

/* ------------------------------------------------------------ barra inferior */
.bottom {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 10;
  width: min(560px, 100%); padding: 0 16px calc(14px + var(--safe-b)); display: grid; gap: 10px;
}
.hint {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 18px;
  background: rgba(255, 253, 248, 0.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(41, 71, 91, 0.14);
}
.hint-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #fff3cf; color: #b98620; flex: none; }
.hint p { margin: 0; font-weight: 700; font-size: 15px; line-height: 1.3; }
.hint small { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; color: var(--coral-d); }
.bottom .btn { width: 100%; }
.bottom { transition: opacity 0.3s, transform 0.3s; }
.bottom.away { opacity: 0; transform: translate(-50%, 30px); pointer-events: none; }

.brand-tag {
  position: absolute; z-index: 21; left: 16px; bottom: calc(14px + var(--safe-b)); font-size: 12px; font-weight: 700;
  color: var(--ink-2); text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.brand-tag img {
  height: 34px; width: auto; display: block; padding: 4px 8px; border-radius: 10px;
  background: rgba(248, 246, 243, 0.92); box-shadow: 0 4px 12px rgba(15, 30, 106, 0.12);
}
.brand-tag.in-game { display: none; }
@media (min-width: 900px) { .brand-tag.in-game { display: block; } }

/* ------------------------------------------------------------ hoja de protección */
.sheet {
  position: absolute; z-index: 30; left: 50%; bottom: 0; width: min(480px, 100%);
  transform: translate(-50%, 105%); transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  background: var(--white); border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -10px 40px rgba(41, 71, 91, 0.22);
  padding: 18px 20px calc(20px + var(--safe-b));
}
.sheet.open { transform: translate(-50%, 0); }
@media (min-width: 700px) { .sheet { bottom: 20px; border-radius: var(--radius); } .sheet:not(.open) { transform: translate(-50%, 120%); } }
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head > div { flex: 1; }
.sheet-head h3 { margin: 0; font-size: 21px; font-weight: 900; }
.sheet-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--cream); color: var(--deep); flex: none; }
.sheet-ico .ico { width: 26px; height: 26px; }
.sheet-ico.lvl1 { background: #fff3cf; }
.sheet-ico.lvl2 { background: var(--sage); color: var(--white); }
.lvl-label { margin: 2px 0 0; display: flex; align-items: center; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.desc { margin: 14px 0 10px; font-size: 16px; line-height: 1.45; font-weight: 600; }
.perks { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.perks li { display: grid; gap: 1px; padding: 10px 12px; border-radius: 14px; background: var(--cream); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.perks li b { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--coral-d); }
.perks li.on { background: #eef6eb; color: var(--deep); }
.perks li.on b { color: var(--good); }
.short { margin: 8px 0 0; text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.maxed { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 16px; background: #eef6eb; font-weight: 800; color: var(--good); }

/* ------------------------------------------------------------ evento */
.modal {
  position: absolute; inset: 0; z-index: 40; display: grid; place-items: end center;
  padding: 16px 16px calc(16px + var(--safe-b)); background: transparent; pointer-events: none;
}
.modal .event-card { pointer-events: auto; }
.event-card {
  width: 100%; max-width: 480px; padding: 16px 18px 18px; text-align: left; max-height: 62%; overflow: auto;
  transform: translateY(30px) scale(0.96); opacity: 0; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.3), opacity 0.2s;
}
.modal.open .event-card { transform: none; opacity: 1; }
.ev-tag { margin: 0 0 10px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: var(--coral-d); }
.ev-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.ev-head .ev-tag { margin: 0 0 2px; }
.ev-ico {
  width: 52px; height: 52px; flex: none; border-radius: 18px; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffe9e1, var(--cream)); color: var(--coral-d); animation: wiggle 0.7s 0.2s;
}
.ev-ico .ico { width: 28px; height: 28px; }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
.event-card h2 { margin: 0; font-size: 21px; font-weight: 900; line-height: 1.15; }
.ev-text { margin: 0 0 12px; font-size: 16px; line-height: 1.5; font-weight: 600; color: var(--ink-2); }
.ev-q { margin: 0 0 10px; font-size: 14px; font-weight: 800; color: var(--deep); }
.ev-actions { display: grid; gap: 8px; }
.btn.option { justify-content: space-between; text-align: left; background: var(--cream); box-shadow: 0 3px 0 rgba(41, 71, 91, 0.1); font-size: 16px; padding: 12px 16px; }
.costs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.costs em { font-style: normal; font-size: 13px; display: inline-flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 10px; background: var(--white); white-space: nowrap; }
.costs .ico { width: 14px; height: 14px; }
.neg { color: var(--coral-d); }
.pos { color: var(--good); }
.ev-banner { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 12px; padding: 10px 16px; border-radius: 16px; font-weight: 900; font-size: 18px; }
.ev-banner.good { background: #e6f3e1; color: #4f8a46; animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
.ev-banner.meh { background: #fdebe4; color: var(--coral-d); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.fx-row { display: flex; gap: 8px; justify-content: flex-start; flex-wrap: wrap; margin: -4px 0 14px; }
.fx { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 12px; font-weight: 900; font-size: 14px; background: var(--cream); }
.ev-tip { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px 14px; margin-bottom: 14px; border-radius: 16px; background: #eaf5fb; color: var(--deep); }
.ev-tip p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.ev-tip .ico { color: var(--sky); width: 22px; height: 22px; filter: saturate(1.4) brightness(0.8); }

/* ------------------------------------------------------------ tutorial */
.coach { position: absolute; inset: 0; z-index: 25; pointer-events: auto; }
.coach.passthrough { pointer-events: none; }
.coach.sheet-open .coach-card, .coach.sheet-open .spot { opacity: 0; pointer-events: none; }
.spot {
  position: fixed; border-radius: 22px; pointer-events: none; transition: all 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  box-shadow: 0 0 0 4px var(--yellow), 0 0 0 9999px rgba(41, 71, 91, 0.42);
  animation: spotPulse 1.4s ease-in-out infinite;
}
@keyframes spotPulse { 50% { box-shadow: 0 0 0 8px rgba(245, 201, 106, 0.7), 0 0 0 9999px rgba(41, 71, 91, 0.42); } }
.coach-card {
  position: fixed; left: 50%; transform: translateX(-50%); width: min(380px, calc(100% - 32px));
  padding: 18px 20px; text-align: left; pointer-events: auto; transition: top 0.35s, bottom 0.35s, opacity 0.2s;
}
.coach-card.center { top: 50% !important; transform: translate(-50%, -50%); }
.coach:not(:has(.spot:not([hidden]))) { background: rgba(41, 71, 91, 0.42); }
.coach-step { margin: 0 0 4px; font-size: 12px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; color: var(--coral-d); }
.coach-card h3 { margin: 0 0 6px; font-size: 22px; font-weight: 900; }
.coach-card p#coachText { margin: 0 0 14px; font-size: 16px; line-height: 1.45; font-weight: 600; color: var(--ink-2); }

/* ------------------------------------------------------------ letrero de la hora */
.caption {
  position: absolute; z-index: 12; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 8px 16px 8px 8px;
  border-radius: 18px; background: var(--deep); color: var(--white); box-shadow: 0 10px 26px rgba(41, 71, 91, 0.3);
}
.caption.in { animation: rise 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; }
.caption span { flex: none; padding: 6px 10px; border-radius: 12px; background: var(--yellow); color: var(--deep); font-weight: 900; font-size: 14px; }
.caption p { margin: 0; font-weight: 800; font-size: 15px; line-height: 1.25; }

/* ------------------------------------------------------------ globitos sobre la escena */
.bubbles { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 12px; border-radius: 18px; background: var(--white); color: var(--deep);
  font-weight: 800; font-size: 14px; box-shadow: 0 8px 20px rgba(41, 71, 91, 0.2);
  animation: bubbleIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.5) both; transition: opacity 0.25s;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px; margin-left: -7px;
  background: inherit; transform: rotate(45deg); border-radius: 3px;
}
.bubble b { font-size: 20px; line-height: 1; }
.bubble.sad { background: #fdebe4; }
.bubble.happy { background: #e9f5e4; }
.bubble.out { opacity: 0 !important; }
@keyframes bubbleIn { from { opacity: 0; scale: 0.4; } }
.floater { position: absolute; z-index: 7; font-size: 22px; pointer-events: none; animation: floatAway 1.8s ease-out both; }
@keyframes floatAway { from { opacity: 0; transform: translateY(0) scale(0.5); } 20% { opacity: 1; transform: translateY(-14px) scale(1.1); } to { opacity: 0; transform: translateY(-80px) scale(0.9); } }
.coin-btn {
  position: absolute; left: 0; top: 0; width: 64px; height: 64px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; pointer-events: auto;
}
.coin-btn::before {
  content: ''; position: absolute; inset: 10px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 16px rgba(245, 201, 106, 0.9); animation: coinRing 1.1s ease-in-out infinite;
}
@keyframes coinRing { 50% { transform: scale(1.18); opacity: 0.6; } }
.coin.fly { position: fixed; z-index: 70; width: 30px; height: 30px; margin: -15px 0 0 -15px; transition: transform 0.6s cubic-bezier(0.5, 0, 0.3, 1); pointer-events: none; }

/* ------------------------------------------------------------ final */
.end-screen { overflow-y: auto; padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b)); background: rgba(41, 71, 91, 0); transition: background 0.6s; }
.end-screen.open { background: rgba(41, 71, 91, 0.25); }
.end-wrap { max-width: 480px; margin: 0 auto; display: grid; gap: 14px; }
.end-screen .card { opacity: 0; transform: translateY(40px); transition: 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
.end-screen.open .card { opacity: 1; transform: none; }
.end-screen.open .brand-card { transition-delay: 0.35s; }
.result-card { padding: 24px 20px 20px; text-align: center; }
.stars { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.stars span { color: var(--line); }
.stars span .ico { width: 42px; height: 42px; fill: currentColor; stroke-width: 1.5; }
.stars span.on { color: var(--yellow); animation: starIn 0.6s var(--d) cubic-bezier(0.2, 0.9, 0.3, 1.6) both; }
.stars span.on .ico { stroke: var(--yellow-d); }
@keyframes starIn { from { transform: scale(0) rotate(-40deg); } }
.result-card h2 { margin: 0 0 8px; font-size: 32px; font-weight: 900; line-height: 1.05; }
.lead { margin: 0 0 16px; font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stats div { padding: 12px 6px; border-radius: 16px; background: var(--cream); display: grid; gap: 2px; }
.stats b { font-size: 24px; font-weight: 900; }
.stats span { font-size: 12px; font-weight: 700; color: var(--ink-2); line-height: 1.2; }
.result-card h4 { margin: 12px 0 8px; text-align: left; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.plist li { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px 7px 7px; border-radius: 14px; font-size: 14px; font-weight: 800; }
.plist li span { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; }
.plist li span .ico { width: 15px; height: 15px; }
.plist li.ok { background: #eef6eb; }
.plist li.ok span { background: var(--sage); color: #fff; }
.plist li.todo { background: var(--cream); color: var(--ink-2); }
.plist li.todo span { background: var(--white); }
.end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.end-actions .btn { font-size: 15px; padding: 12px; }

.brand-card { padding: 22px 22px 20px; background: linear-gradient(160deg, var(--brand-2), var(--brand) 60%); color: var(--white); text-align: center; position: relative; overflow: hidden; }
.brand-card::before {
  content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; top: -120px;
  background: radial-gradient(circle, rgba(247, 190, 0, 0.22), transparent 70%);
}
.brand-logo {
  position: relative; display: block; width: fit-content; margin: 0 auto 14px; padding: 10px 18px; border-radius: 18px;
  background: var(--brand-paper); box-shadow: 0 8px 20px rgba(7, 12, 34, 0.35);
}
.brand-logo img { display: block; height: 52px; width: auto; }
.brand-card .btn.primary { position: relative; background: var(--brand-gold); color: var(--brand); box-shadow: 0 4px 0 var(--brand-accent), 0 12px 26px rgba(7, 12, 34, 0.35); }
.brand-card .btn.primary:active { box-shadow: 0 1px 0 var(--brand-accent), 0 4px 10px rgba(7, 12, 34, 0.3); }
.brand-pet {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; margin: -6px 0 16px;
  font-size: 14px; font-weight: 800; color: var(--brand-gold);
}
.brand-pet .ico { width: 18px; height: 18px; flex: none; }
.brand-link { position: relative; display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 800; color: var(--brand-gold); text-decoration: none; letter-spacing: 0.02em; }
.brand-link:hover { text-decoration: underline; }
.brand-kicker { position: relative; margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-gold); }
.brand-copy { position: relative; margin: 10px 0 18px; font-size: 16px; line-height: 1.5; font-weight: 600; opacity: 0.88; }

/* ------------------------------------------------------------ toasts */
.toasts { position: absolute; z-index: 45; left: 50%; top: calc(66px + var(--safe-t)); transform: translateX(-50%); display: grid; gap: 6px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 16px; background: var(--deep); color: var(--white); font-weight: 700; font-size: 14px; text-align: center;
  box-shadow: 0 10px 24px rgba(41, 71, 91, 0.3); animation: rise 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.3) both; transition: opacity 0.4s, transform 0.4s;
}
.toast.out { opacity: 0; transform: translateY(-10px); }

@media (max-width: 420px) {
  .hud { padding-left: 12px; padding-right: 12px; }
  .pill { padding: 0 10px; gap: 6px; }
  .tranq-bar { width: 44px; }
  .year-pill { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------ título: continuar */
.title-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ estrellas, tienda y cuotas */
.star-pill b { font-size: 18px; }
.star-ico { font-size: 18px; line-height: 1; }
.bottom-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.bottom .bottom-row .btn { width: auto; }
.bottom .bottom-row #advanceBtn { width: 100%; }
.shop-btn { padding: 12px 16px; gap: 6px; font-size: 22px; }
.shop-btn span { font-size: 16px; }
@media (max-width: 420px) { .shop-btn span { display: none; } .star-pill { padding: 0 8px; } .pill small { display: none; } }

.btn.sm { min-height: 38px; padding: 8px 12px; font-size: 14px; border-radius: 12px; }
.buy-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.buy-row .btn { flex-direction: column; gap: 2px; padding: 10px 12px; }
.buy-row .btn small { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }
.cuota-note { margin: 10px 2px 0; font-size: 13px; line-height: 1.45; font-weight: 600; color: var(--ink-2); }
.cuota-note b { color: var(--good); }
.pending { display: flex; align-items: center; gap: 6px; margin: -6px 0 12px; padding: 8px 12px; border-radius: 12px; background: #eaf5fb; font-size: 14px; font-weight: 800; }
.pending .ico { color: var(--good); }
.stars-won { margin: -4px 0 12px; padding: 10px 12px; border-radius: 14px; background: #fff3cf; font-weight: 700; font-size: 14px; }

.shop { position: absolute; inset: 0; z-index: 55; display: grid; place-items: end center; padding: 16px 16px calc(16px + var(--safe-b)); background: rgba(41, 71, 91, 0); transition: background 0.25s; }
.shop.open { background: rgba(41, 71, 91, 0.3); }
@media (min-width: 700px) { .shop { place-items: center; } }
.shop-card { width: 100%; max-width: 520px; max-height: 88%; overflow: auto; padding: 18px; transform: translateY(30px); opacity: 0; transition: 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.shop.open .shop-card { transform: none; opacity: 1; }
.shop-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.shop-head h3 { margin: 0; font-size: 24px; font-weight: 900; }
.shop-head p { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.wallet { display: flex; gap: 8px; margin: 12px 0; }
.wallet span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--cream); font-weight: 700; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { flex: 1; min-height: 42px; border: 0; border-radius: 12px; background: var(--cream); font: 800 15px 'Nunito', sans-serif; color: var(--ink-2); cursor: pointer; }
.tab.on { background: var(--deep); color: var(--white); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.shop-item { display: grid; justify-items: center; gap: 4px; padding: 12px 10px; border-radius: 18px; border: 2px solid var(--line); text-align: center; }
.shop-item.on { border-color: var(--sage); background: #f2f8ef; }
.si-emoji { font-size: 34px; line-height: 1.1; }
.si-name { font-weight: 900; font-size: 14px; line-height: 1.2; min-height: 34px; display: grid; place-items: center; }
.si-price { font-size: 13px; font-weight: 800; color: var(--ink-2); display: inline-flex; gap: 4px; align-items: center; }
.shop-item .btn { width: 100%; margin-top: 4px; }
.shop-note { margin: 12px 2px 0; font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--ink-2); }
.end-actions { grid-template-columns: 1fr 1fr; }
.end-actions .wide { grid-column: 1 / -1; }
.buy-row .pr { display: inline-flex; align-items: center; gap: 4px; }
