:root {
  --bg: #fbf7f1;
  --panel: #ffffff;
  --soft: #f4eee6;
  --line: #ebe3d8;
  --text: #22180f;
  --muted: #8a7d6e;
  --accent: #6c3df4;
  --accent-soft: #efe9ff;
  --gold: #e9a600;
  --gold-soft: #fff4d6;
  --silver-soft: #f1f1f4;
  --bronze-soft: #fbece2;
  --up: #12a56a;
  --down: #e5484d;
  --radius: 14px;
  --fire: linear-gradient(135deg, #ff9a3c 0%, #ff4d5e 55%, #ff2e88 100%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 'Bricolage Grotesque', system-ui, sans-serif; }
h1, h2, p { margin: 0; }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.gold { color: var(--gold); }
body[data-mode="devnet"] .demo-only, body[data-mode="demo"] .devnet-only { display: none !important; }

/* Todo cabe en una pantalla: la lista y el directo hacen scroll por dentro */
.screen { height: 100vh; height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; max-width: 1240px; margin: 0 auto; padding: 0 20px; }

.top { display: flex; align-items: center; gap: 14px; padding: 14px 0 6px; flex-wrap: wrap; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.brand b { color: var(--accent); }
.season-pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--muted); }
#countdown { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.overtime { background: var(--down); color: #fff; font-weight: 800; font-size: 11px; padding: 2px 7px; border-radius: 6px; margin-left: 4px; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.controls { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.modes { display: flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.modes button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.modes button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.wallet { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.banner { background: var(--gold-soft); border: 1px solid #f3d27a; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-top: 6px; }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover:not(:disabled) { border-color: #cfc3b3; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 800; }
.btn.primary:hover:not(:disabled) { background: #5a2ee0; }
.btn.down { color: var(--down); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 13px; }

/* ranking: centrado, lo primero que se ve */
.screen { display: flex; flex-direction: column; }
.board { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 12px;
  background: radial-gradient(ellipse 420px 300px at 50% 120px, rgba(255, 207, 61, .28), transparent 70%) no-repeat; }
.board-inner { width: 100%; max-width: 760px; margin: 0 auto; }
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

/* podio de competición: 2º a la izquierda, 1º en el centro (más alto), 3º a la derecha */
.podium { display: grid; grid-template-columns: 1fr 1.25fr 1fr; align-items: end; gap: 10px; margin: 8px 0 18px; }
.step { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.step .pet { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 6px 10px; min-width: 0; width: 100%; }
.step img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 4px solid var(--panel); box-shadow: 0 6px 18px rgba(34,24,15,.12); }
.step .name { font-weight: 800; font-size: 16px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 6px; }
.step .phrase { color: var(--muted); font-size: 12.5px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step .sol { font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.step .row-actions { opacity: 1; margin-top: 6px; }
.block { width: 100%; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-weight: 800; color: rgba(255,255,255,.95);
  text-shadow: 0 2px 6px rgba(0,0,0,.18); font-size: 34px; }
.s2 .block { height: 96px; background: linear-gradient(180deg, #d9dce3, #aeb4c0); }
.s3 .block { height: 66px; background: linear-gradient(180deg, #e7b48f, #c58358); }
.s2 img { border-color: #c9ced8; }
.s3 img { border-color: #dba27b; }

/* el #1 se destaca mucho más */
.s1 .block { height: 140px; font-size: 56px; background: linear-gradient(180deg, #ffd65a, #e9a600);
  box-shadow: 0 14px 40px rgba(233, 166, 0, .35); position: relative; overflow: hidden; }
.s1 .block::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.55) 45%, transparent 60%);
  transform: translateX(-100%); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 60%, 100% { transform: translateX(100%); } }
.s1 .crown { font-size: 40px; line-height: 1; margin-bottom: -6px; animation: float 2.4s ease-in-out infinite; filter: drop-shadow(0 4px 8px rgba(233,166,0,.5)); }
@keyframes float { 50% { transform: translateY(-6px) rotate(-4deg); } }
.s1 img { width: 128px; height: 128px; border: 6px solid #ffcf3d; box-shadow: 0 0 0 6px rgba(255, 207, 61, .25), 0 0 46px rgba(255, 190, 30, .55); }
.s1 .name { font-size: 24px; }
.s1 .sol { font-size: 28px; color: var(--accent); }
.s1 .phrase { font-size: 13.5px; font-style: italic; }
.step.empty .pet { color: var(--muted); padding-bottom: 14px; }
.step.empty img { opacity: .35; }

.ranking li { display: grid; grid-template-columns: 40px 48px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.ranking li.mine { box-shadow: inset 3px 0 0 var(--accent); }
.ranking .pos { font-weight: 800; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.ranking img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.ranking .who { min-width: 0; }
.ranking .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking .who span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ranking .sol { font-weight: 800; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ranking .empty { display: block; text-align: center; color: var(--muted); }
.row-actions { display: flex; gap: 4px; align-items: center; justify-content: center; }
.row-actions button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; min-width: 34px; height: 34px; cursor: pointer; font-size: 14px;
  transition: transform .12s, filter .12s; }
.row-actions button:hover { transform: translateY(-1px); border-color: #cfc3b3; }
.row-actions .up { font: inherit; font-weight: 800; font-size: 14px; color: #fff; white-space: nowrap; border: 0; padding: 0 14px; background: var(--fire);
  box-shadow: 0 4px 12px rgba(255, 70, 90, .3); }
.row-actions .up:hover { filter: brightness(1.08); transform: translateY(-1px) scale(1.05); border: 0; }
.row-actions .down { font-size: 15px; }
.s1 .row-actions .up { padding: 0 20px; height: 40px; font-size: 16px; animation: throb 1.8s ease-in-out infinite; }
.ranking li { transition: transform .15s, box-shadow .15s; }
.ranking li:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(34, 24, 15, .07); }
.ranking li:nth-child(-n+3) .pos { color: var(--text); }
.bump { animation: bump .6s ease; }
@keyframes bump { 30% { transform: scale(1.015); border-color: var(--accent); } }

/* barra inferior: añadir mascota · pujar */
.bar { padding: 6px 0 8px; display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; justify-content: center; align-items: stretch; gap: 12px; }
.add-btn, .bid-btn { flex: none; display: flex; align-items: center; gap: 10px; border: 0; border-radius: 18px; padding: 10px 20px 10px 14px;
  font: inherit; font-weight: 800; font-size: 16px; line-height: 1.1; text-align: left; cursor: pointer; transition: transform .15s, box-shadow .15s, filter .15s; }
.add-btn small, .bid-btn small { display: block; font-size: 12px; font-weight: 600; opacity: .8; margin-top: 2px; }
.add-btn .ico, .bid-btn .ico { font-size: 24px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.bid-btn { position: relative; overflow: hidden; color: #fff; font-size: 20px; text-transform: uppercase; letter-spacing: .01em;
  background: var(--fire); box-shadow: 0 10px 28px rgba(255, 70, 90, .45), inset 0 -3px 0 rgba(0,0,0,.15); animation: throb 1.8s ease-in-out infinite; }
.bid-btn small { text-transform: none; letter-spacing: 0; }
.bid-btn .ico { background: rgba(255,255,255,.22); animation: hammer 1.8s ease-in-out infinite; transform-origin: 70% 70%; }
.bid-btn::after, .btn.fire::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.5) 50%, transparent 65%); transform: translateX(-100%); animation: shine 2.6s ease-in-out infinite; }
.bid-btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.08) saturate(1.1); box-shadow: 0 14px 34px rgba(255, 70, 90, .55); }
.bid-btn:active, .add-btn:active { transform: scale(.97); }
.add-btn[hidden], .bid-btn[hidden] { display: none; }
@keyframes throb { 0%, 100% { box-shadow: 0 10px 28px rgba(255, 70, 90, .45), 0 0 0 0 rgba(255, 90, 90, .45); }
  50% { box-shadow: 0 10px 28px rgba(255, 70, 90, .45), 0 0 0 10px rgba(255, 90, 90, 0); } }
@keyframes hammer { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-28deg); } 86% { transform: rotate(12deg); } }

/* tira de últimos movimientos: se desplaza sin parar */
.tape { position: relative; flex: none; overflow: hidden; padding: 8px 0 2px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.tape-track { display: flex; gap: 10px; width: max-content; will-change: transform; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.chip b { font-weight: 700; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.chip i { font-style: normal; font-weight: 900; font-variant-numeric: tabular-nums; padding: 1px 8px; border-radius: 999px; }
.chip.up i { color: #fff; background: var(--up); }
.chip.down i { color: #fff; background: var(--down); }
.chip.new i { background: var(--accent-soft); }
.chip.idle { color: var(--muted); padding-left: 10px; }
.chip.fresh { animation: fresh 1.2s ease-out; }
.chip.fresh.up { box-shadow: 0 0 0 2px var(--up), 0 0 16px rgba(18, 165, 106, .45); }
.chip.fresh.down { box-shadow: 0 0 0 2px var(--down), 0 0 16px rgba(229, 72, 77, .45); }
@keyframes fresh { 0% { transform: scale(1.35); } 40% { transform: scale(.95); } 70% { transform: scale(1.05); } }

.pick-list { list-style: none; margin: 0; padding: 0; max-height: min(60vh, 460px); overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pick-list li { display: grid; grid-template-columns: 34px 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: transform .12s, border-color .12s; }
.pick-list li:hover, .pick-list li:focus-visible { border-color: #ff7a45; background: #fff3ec; outline: none; transform: translateX(3px); }
.pick-list li:first-child { background: var(--gold-soft); border-color: #f3d27a; }
.pick-list img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.pick-list b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-list .pos { color: var(--muted); font-weight: 800; font-size: 13px; }
.pick-list .gap { color: #fff; background: var(--fire); font-weight: 800; font-size: 12.5px; white-space: nowrap; padding: 4px 9px; border-radius: 999px; }
.pick-list li:first-child .gap { background: linear-gradient(135deg, #ffd65a, #e9a600); color: #3b2600; }

@media (prefers-reduced-motion: reduce) { .bid-btn, .bid-btn .ico, .bid-btn::after, .btn.fire::after, .chip.fresh { animation: none; } .tape { overflow-x: auto; } }
@media (max-width: 860px) {
  .add-btn, .bid-btn { flex: 1 1 0; justify-content: center; }
  .add-btn { flex-grow: .8; }
}
@media (max-width: 520px) {
  .chip { font-size: 12px; }
  .add-btn, .bid-btn { padding: 8px 12px 8px 8px; font-size: 14px; gap: 8px; }
  .bid-btn { font-size: 17px; }
  .add-btn .ico, .bid-btn .ico { width: 32px; height: 32px; font-size: 19px; }
  .add-btn small, .bid-btn small { font-size: 11px; }
}

/* diálogos */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(34, 24, 15, .25); }
dialog::backdrop { background: rgba(34, 24, 15, .35); backdrop-filter: blur(2px); }
.dlg { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.dlg h2 { font-size: 18px; }
.dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.dlg input, .dlg select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.dlg label.check { flex-direction: row; gap: 8px; color: var(--text); align-items: flex-start; }
.dlg label.check input { margin-top: 3px; }
.act-pet { display: flex; gap: 12px; align-items: center; }
.act-pet img { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tab { border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-weight: 800; padding: 9px; border-radius: 10px; cursor: pointer; }
.tab.active[data-type="boost"] { border-color: #ff7a45; color: #e8452f; background: #fff1ea; }
.tab.active[data-type="sink"] { border-color: var(--down); color: var(--down); background: #fdeeee; }
.amounts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.amounts button { border: 1px solid var(--line); background: var(--panel); font: inherit; font-weight: 800; padding: 11px 2px; border-radius: 12px; cursor: pointer;
  transition: transform .12s; }
.amounts button:hover { transform: translateY(-1px); border-color: #cfc3b3; }
.amounts button.active { border-color: #ff7a45; color: #e8452f; background: #fff1ea; box-shadow: 0 0 0 2px rgba(255, 122, 69, .25); }
.amounts .crown-chip { grid-column: 1 / -1; color: #3b2600; border: 0; background: linear-gradient(135deg, #ffe48a, #ffc93d); font-size: 16px;
  box-shadow: 0 4px 14px rgba(233, 166, 0, .35); }
.amounts .crown-chip.active { color: #3b2600; background: linear-gradient(135deg, #ffd65a, #e9a600); box-shadow: 0 0 0 3px rgba(233, 166, 0, .35), 0 4px 14px rgba(233, 166, 0, .4); }
.rank-badge { display: block; width: fit-content; margin: 8px auto 0; font-size: 14px; font-weight: 800; padding: 5px 12px; border-radius: 999px;
  background: var(--soft); color: var(--muted); }
.rank-badge.gold { background: linear-gradient(135deg, #ffe48a, #ffc93d); color: #3b2600; animation: pop .35s ease-out; }
.rank-badge.up { background: #eafaf2; color: var(--up); }
.rank-badge.down { background: #fdeeee; color: var(--down); }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } }
.btn.fire { position: relative; overflow: hidden; color: #fff; border: 0; font-weight: 800; font-size: 16px; padding: 12px 16px; background: var(--fire);
  box-shadow: 0 8px 22px rgba(255, 70, 90, .4); }
.btn.fire:hover:not(:disabled) { filter: brightness(1.08); }
.btn.fire.sink { background: linear-gradient(135deg, #5b5f6b, #2c2f36); box-shadow: 0 8px 22px rgba(30, 30, 40, .3); }
.actions .btn.fire { flex: 1; }
.dlg label.custom { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.custom span { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.custom input { width: 120px; font: inherit; font-weight: 700; text-align: right; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }
.custom input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.preview { text-align: center; font-size: 20px; font-weight: 800; }
.actions { display: flex; gap: 8px; }
.actions .btn.primary { flex: 1; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 12px; padding: 10px 14px;
  max-width: 340px; font-size: 14px; box-shadow: 0 10px 30px rgba(34,24,15,.15); animation: in .2s ease-out; }
.toast.ok { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
.toast.gold { border-left-color: var(--gold); }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }

/* móvil: no cabe en una pantalla, así que se hace scroll normal */
@media (max-width: 860px) {
  .screen { height: auto; overflow: visible; display: block; padding: 0 16px; }
  .board { overflow: visible; }
  .controls { margin-left: 0; }
  .bar { position: sticky; bottom: 0; background: var(--bg); }
}
@media (max-width: 520px) {
  .ranking li { grid-template-columns: 30px 44px minmax(0, 1fr) auto; }
  .podium { gap: 6px; grid-template-columns: 1fr 1.2fr 1fr; }
  .step img { width: 54px; height: 54px; border-width: 3px; }
  .s1 img { width: 84px; height: 84px; border-width: 4px; }
  .step .name { font-size: 13px; }
  .s1 .name { font-size: 16px; }
  .step .sol { font-size: 14px; }
  .s1 .sol { font-size: 18px; }
  .step .phrase { display: none; }
  .s1 .block { height: 110px; font-size: 44px; }
  .s2 .block { height: 76px; font-size: 28px; }
  .s3 .block { height: 52px; font-size: 26px; }
  .ranking li { grid-template-columns: 26px 44px minmax(0, 1fr) auto; grid-template-areas: "pos img who act" "pos img sol act"; gap: 2px 10px; padding: 8px 10px; }
  .ranking li .pos { grid-area: pos; font-size: 13px; }
  .ranking li img { grid-area: img; width: 44px; height: 44px; }
  .ranking li .who { grid-area: who; }
  .ranking li .who span { display: none; }
  .ranking li .sol { grid-area: sol; text-align: left; font-size: 15px; }
  .ranking li .row-actions { grid-area: act; }
  .step .row-actions button { min-width: 28px; height: 30px; }
  .step .row-actions .up, .s1 .row-actions .up { padding: 0 9px; height: 30px; font-size: 12.5px; }
}

/* entrar y mi perfil */
.login-btn { font-weight: 800; color: #fff; background: var(--accent); border-color: transparent; }
.login-btn:hover:not(:disabled) { background: #5a2ee0; }
.me-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 3px 12px 3px 3px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text); }
.me-chip:hover { border-color: var(--accent); }
.me-chip img, .me-chip .me-emoji { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--accent-soft); font-size: 16px; }
.me-chip span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.me-chip small { color: var(--muted); font-weight: 600; font-size: 11px; }
.login-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  font: inherit; color: var(--text); text-decoration: none; cursor: pointer; text-align: left; transition: transform .12s, border-color .12s; }
.wallet-opt:hover { border-color: var(--accent); transform: translateX(3px); }
.wallet-opt b { flex: 1; font-size: 16px; }
.w-ico { font-size: 24px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); }
.w-tag { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.w-tag.ok { color: var(--up); }
.profile { width: min(480px, calc(100vw - 32px)); }
.profile .dlg { max-height: min(86vh, 760px); overflow-y: auto; }
.profile h3 { margin: 4px 0 0; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.prof-head { display: flex; align-items: center; gap: 14px; }
.prof-avatar img, .prof-avatar .me-emoji { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: var(--accent-soft); font-size: 30px; box-shadow: 0 0 0 4px var(--gold-soft); }
.prof-id { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.prof-id b { font-size: 20px; }
.prof-id span { flex-basis: 100%; }
.link-btn { border: 0; background: none; cursor: pointer; font-size: 15px; padding: 2px; }
.link-btn[hidden] { display: none; }
.prof-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prof-stats div { background: var(--soft); border-radius: 14px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.prof-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.prof-stats span { font-size: 12px; color: var(--muted); }
.prof-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.prof-list li { display: grid; grid-template-columns: 34px 40px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 12px; }
.prof-list.moves li { grid-template-columns: 32px minmax(0, 1fr) auto auto; }
.prof-list.invoices li { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.prof-list img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.prof-list.moves img { width: 32px; height: 32px; }
.prof-list b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-list .pos { color: var(--muted); font-weight: 800; font-size: 13px; }
.prof-list .sol { font-weight: 800; font-variant-numeric: tabular-nums; }
.prof-list i { font-style: normal; font-weight: 900; color: #fff; padding: 1px 8px; border-radius: 999px; font-size: 13px; }
.prof-list i.up { background: var(--up); }
.prof-list i.down { background: var(--down); }
.prof-list li.empty { display: block; color: var(--muted); text-align: center; padding: 12px; }
.profile .actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) {
  .prof-list li { grid-template-columns: 30px 36px minmax(0, 1fr) auto; }
  .prof-list li .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

/* --- pulido -------------------------------------------------------------------------------- */
.foot { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0 10px; }
.season-pill { white-space: nowrap; }
.me-chip span { white-space: nowrap; }
.prof-list li .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(108, 61, 244, .45); outline-offset: 2px; }
.chip.new i { color: var(--accent); background: var(--accent-soft); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

.step.s1 .pet img { transition: transform .3s; }
.step.s1.crowned .pet img { animation: crowned 1s ease; }
@keyframes crowned { 30% { transform: scale(1.15) rotate(-4deg); } 60% { transform: scale(.96); } }

@media (max-width: 860px) {
  .top { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding-top: 8px; }
  .controls { grid-column: 1 / -1; justify-content: space-between; }
  .toasts { left: 16px; right: 16px; bottom: 96px; }
  .toast { max-width: none; }
}
@media (max-width: 520px) {
  .brand { font-size: 19px; }
  .season-pill { font-size: 12.5px; padding: 4px 10px; }
}

/* iconos SVG (sustituyen a los emojis) */
.i { display: inline-block; vertical-align: -0.14em; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 6px; }
.brand-crown { color: var(--gold); display: inline-flex; font-size: 22px; }
.season-pill .i { color: var(--muted); }
.crown { color: #f5b800; }
.crown .i { width: 1em; height: 1em; filter: drop-shadow(0 4px 8px rgba(233, 166, 0, .45)); }
.step.empty .crown { opacity: .5; }
.add-btn .ico .i, .bid-btn .ico .i { width: 22px; height: 22px; }
.row-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); }
.row-actions button:hover { color: var(--text); }
.row-actions .up .i { width: 15px; height: 15px; }
.row-actions .down { color: var(--down); }
.tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.fire { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.rank-badge { display: flex; align-items: center; gap: 6px; }
.amounts .crown-chip { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pick-list .gap { display: inline-flex; align-items: center; gap: 4px; }
.login-btn, .h-ico { display: inline-flex; align-items: center; gap: 6px; }
.w-ico { color: #fff; font-weight: 800; font-size: 18px; }
.me-chip .me-emoji, .prof-avatar .me-emoji { color: var(--accent); }
.me-chip .me-emoji .i { width: 18px; height: 18px; }
.prof-avatar .me-emoji .i { width: 32px; height: 32px; }
.link-btn { color: var(--muted); display: inline-flex; }
.link-btn:hover { color: var(--accent); }
.prof-list .btn { display: inline-flex; align-items: center; gap: 5px; }
.chip.new i { font-weight: 800; }

/* medallas del #2 y #3 (como la corona del #1, pero más pequeñas) */
.medal { font-size: 30px; line-height: 1; margin-bottom: -4px; filter: drop-shadow(0 3px 6px rgba(34, 24, 15, .25)); animation: float 2.4s ease-in-out infinite; }
.s3 .medal { animation-delay: -1.2s; }
.step.empty .medal { opacity: .5; }
@media (max-width: 520px) { .medal { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .medal { animation: none; } }

/* botón «Añadir mascota»: morado sólido, huella con un + y brillo al pasar */
.add-btn { position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, #8f6bff 0%, #6c3df4 60%, #5427d8 100%);
  box-shadow: 0 10px 26px rgba(108, 61, 244, .38), inset 0 -3px 0 rgba(0, 0, 0, .14); }
.add-btn .ico { position: relative; background: #fff; color: var(--accent); border-radius: 14px; box-shadow: 0 4px 10px rgba(40, 10, 120, .25); }
.add-btn .ico .i { width: 24px; height: 24px; transition: transform .25s; }
.add-btn .ico-plus { position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: #ffcf3d; color: #3b2600; box-shadow: 0 0 0 2px #6c3df4; }
.add-btn small { opacity: .85; }
.add-btn::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(120px 60px at 30% 0%, rgba(255, 255, 255, .28), transparent 70%); }
.add-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(108, 61, 244, .48), inset 0 -3px 0 rgba(0, 0, 0, .14); }
.add-btn:hover::after { opacity: 1; }
.add-btn:hover .ico .i { transform: rotate(-12deg) scale(1.08); }

.add-btn .lbl, .bid-btn > span:last-child { white-space: nowrap; }
@media (max-width: 520px) { .hide-sm { display: none; } .add-btn .ico-plus { width: 15px; height: 15px; right: -4px; top: -4px; } }

/* --- momentos de gala (src/celebrate.js) ------------------------------------------------------ */
.gala { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow: hidden; cursor: pointer;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, rgba(70, 45, 8, .55), rgba(12, 8, 4, .92));
  backdrop-filter: blur(8px) saturate(1.1); -webkit-backdrop-filter: blur(8px) saturate(1.1); animation: galaIn .45s ease both; }
.gala.out { animation: galaOut .45s ease both; }
@keyframes galaIn { from { opacity: 0; } }
@keyframes galaOut { to { opacity: 0; } }
.gala .rays { position: absolute; left: 50%; top: 45%; width: 1400px; height: 1400px; margin: -700px 0 0 -700px; opacity: .5;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 102, .16) 0deg 4deg, transparent 4deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 55%); mask-image: radial-gradient(circle, #000 0, transparent 55%);
  animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gala .dust { position: absolute; bottom: -10px; border-radius: 50%; background: #ffe08a; box-shadow: 0 0 6px 1px rgba(255, 208, 90, .8);
  animation: dust linear infinite; opacity: 0; }
@keyframes dust { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-105vh); opacity: 0; } }
.gala-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff; padding: 24px;
  animation: cardIn .7s cubic-bezier(.2, .9, .25, 1.05) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.gala-kicker { font-size: 13px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; color: #f5d27a; margin-bottom: 26px;
  animation: fadeUp .6s .15s both; }
.gala-avatar { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.gala-avatar img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 6px rgba(0,0,0,.25), 0 20px 60px rgba(0, 0, 0, .55), 0 0 80px rgba(245, 197, 66, .35); }
.gala-avatar .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 8px rgba(245, 197, 66, .7)); }
.gala-avatar .ring circle { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1.1s .25s cubic-bezier(.6, 0, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.gala-crown { position: absolute; top: -46px; left: 50%; width: 76px; height: 76px; margin-left: -38px; color: #f5c542; z-index: 2;
  filter: drop-shadow(0 6px 14px rgba(245, 197, 66, .6)); animation: crownDrop .9s 1.05s cubic-bezier(.3, 1.5, .5, 1) both; }
.gala-crown .i { width: 100%; height: 100%; }
@keyframes crownDrop { from { opacity: 0; transform: translateY(-60px) rotate(-12deg) scale(.7); } }
.gala-name { margin-top: 22px; font-size: clamp(30px, 6vw, 52px); font-weight: 800; letter-spacing: -.02em; line-height: 1.05;
  background: linear-gradient(180deg, #fff7d6 0%, #f5c542 55%, #c98d10 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: fadeUp .7s .55s both; }
.gala-sub { margin-top: 8px; font-size: 16px; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; animation: fadeUp .7s .7s both; }
.gala-paid { margin-top: 18px; font-size: 13px; color: #f5d27a; border: 1px solid rgba(245, 197, 66, .45); border-radius: 999px; padding: 6px 14px;
  animation: fadeUp .7s .85s both; }
.gala-hint { margin-top: 28px; font-size: 12px; color: rgba(255, 255, 255, .4); animation: fadeUp .7s 1.6s both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }
.bid-card .gala-avatar, .gala-avatar.small { width: 130px; height: 130px; }
.gala-avatar.small img { width: 108px; height: 108px; }
.bid-card .gala-name { font-size: clamp(24px, 5vw, 36px); }
.gala-delta { margin-top: 10px; font-size: 28px; font-weight: 800; color: #6ee7a8; font-variant-numeric: tabular-nums; animation: fadeUp .6s .5s both; }
.bid-card.sink .gala-delta { color: #ff8a8a; }
.gala-rank { margin-top: 14px; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; animation: fadeUp .6s .7s both; }
.gala-rank .old { color: rgba(255, 255, 255, .45); text-decoration: line-through; }
.gala-rank .new { color: #f5d27a; animation: rankPop .5s 1s cubic-bezier(.3, 1.6, .5, 1) both; }
.gala-rank .i { color: rgba(255, 255, 255, .6); }
.gala-rank.same { font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .7); }
@keyframes rankPop { from { transform: scale(.4); opacity: 0; } }

/* aviso arriba cuando otra persona cambia el #1 */
.king-banner { position: fixed; top: 54px; left: 50%; z-index: 45; display: flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px;
  border-radius: 999px; color: #fff; background: rgba(24, 16, 6, .88); border: 1px solid rgba(245, 197, 66, .55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3), 0 0 24px rgba(245, 197, 66, .2); backdrop-filter: blur(6px);
  transform: translateX(-50%); animation: bannerIn .6s cubic-bezier(.2, .9, .25, 1.1) both; white-space: nowrap; max-width: calc(100vw - 32px); }
.king-banner.out { animation: bannerOut .5s ease both; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -20px); } }
@keyframes bannerOut { to { opacity: 0; transform: translate(-50%, -14px); } }
.kb-avatar { position: relative; flex: none; }
.kb-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #f5c542; display: block; }
.kb-crown { position: absolute; top: -12px; left: 50%; margin-left: -9px; width: 18px; height: 18px; color: #f5c542; }
.kb-crown .i { width: 100%; height: 100%; }
.kb-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.kb-text small { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: #f5d27a; }
.kb-text b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.kb-sol { font-weight: 800; color: #f5d27a; font-variant-numeric: tabular-nums; }

/* cifras de SOL que cambian */
.sol.counting { transition: color .3s; }
.sol.counting.rise { color: var(--up); }
.sol.counting.fall { color: var(--down); }

@media (prefers-reduced-motion: reduce) {
  .gala, .gala *, .king-banner { animation-duration: .01s !important; animation-delay: 0s !important; }
  .gala .rays, .gala .dust { display: none; }
}
@media (max-width: 520px) {
  .gala-avatar { width: 150px; height: 150px; }
  .gala-avatar img { width: 126px; height: 126px; }
  .gala-crown { width: 60px; height: 60px; margin-left: -30px; top: -38px; }
  .king-banner { top: 96px; }
}
.banner.danger { background: #fdeeee; border-color: #f3b3b5; color: #8f1d22; font-weight: 600; }
.pay-note { font-size: 12px; color: var(--muted); text-align: center; margin: -4px 0 0; }
.foot a { color: var(--muted); }
