/* PuraNota · componentes. Usa las variables de tokens.css.
   El <body> lleva la clase del mundo: .exp (Expedición) o .arena (Arena). */

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.screen {
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  padding: 16px 16px 104px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.screen.no-tabbar { padding-bottom: 24px; }
body.arena { background: #0F1020; }
.arena .screen {
  background:
    radial-gradient(90% 42% at 50% -6%, rgba(124, 58, 237, .55), rgba(124, 58, 237, 0) 70%),
    radial-gradient(70% 30% at 100% 100%, rgba(255, 79, 216, .22), rgba(255, 79, 216, 0) 70%),
    radial-gradient(70% 30% at 0% 82%, rgba(34, 211, 238, .18), rgba(34, 211, 238, 0) 70%),
    linear-gradient(180deg, #0F1020 0%, #1B1140 100%);
}

/* ---------- Botones «gorditos» ---------- */
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 14px 20px;
  border-radius: var(--r-btn);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .2px;
  text-decoration: none;
  color: var(--on-primary);
  background: var(--primary);
  box-shadow: 0 4px 0 var(--primary-press);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--primary-press); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: none; min-height: 44px; font-size: 17px; }
.btn[disabled], .btn.is-disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: #3B2A00; box-shadow: 0 4px 0 var(--gold-press); }
.btn.sm { min-height: 44px; font-size: 16px; padding: 8px 14px; width: auto; }
.arena .btn { box-shadow: 0 4px 0 var(--primary-press), 0 0 28px rgba(34, 211, 238, .45); }
.arena .btn.magenta { background: var(--accent); color: #2A0A26; box-shadow: 0 4px 0 #B81E97, 0 0 28px rgba(255, 79, 216, .45); }
.arena .btn.secondary { background: rgba(255, 255, 255, .06); color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.arena .btn.ghost { box-shadow: none; }
.arena .btn[disabled], .arena .btn.is-disabled { background: #2A2750; color: #7C7FA6; box-shadow: none; }
/* Puente hacia la Arena desde una pantalla de la Expedición */
.btn.to-arena { background: #1B1140; color: #F5F7FF; box-shadow: 0 4px 0 #0F1020, inset 0 0 0 2px #22D3EE; }

/* ---------- Tarjetas, chips, avatar ---------- */
.card { background: var(--surface); border-radius: var(--r-card); padding: 16px; box-shadow: 0 2px 0 var(--line), 0 10px 24px rgba(31, 41, 55, .06); }
.arena .card { box-shadow: 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, .35); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; background: var(--surface); box-shadow: 0 2px 0 var(--line); white-space: nowrap; }
.chip.streak, .chip.combo { background: #FFE8CC; color: #B45309; box-shadow: 0 2px 0 #F5CC99; }
.chip.tema { background: #E0F2FE; color: #075985; box-shadow: none; }
.arena .chip { background: rgba(255, 255, 255, .08); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.arena .chip.hot { color: var(--gold); }

.avatar { --av: #FFD8A8; flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; line-height: 1; background: var(--av); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line); }
.avatar.lg { width: 68px; height: 68px; font-size: 38px; }
.avatar.xl { width: 92px; height: 92px; font-size: 52px; }
.arena .avatar { box-shadow: 0 0 0 3px #1E1B3A, 0 0 0 5px var(--ring, #22D3EE), 0 0 18px var(--ring, #22D3EE); }

/* Pere, la mascota (por ahora un emoji; la ilustración final se define en diseño) */
.pere { position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; line-height: 1; background: linear-gradient(160deg, #D9F99D, #86EFAC); box-shadow: 0 0 0 3px var(--surface), 0 3px 0 3px var(--line); }
.pere.lg { width: 96px; height: 96px; font-size: 56px; }
.pere.gamer { background: linear-gradient(160deg, #312E81, #6D28D9); box-shadow: 0 0 0 3px #1E1B3A, 0 0 0 5px #FF4FD8, 0 0 22px #FF4FD8; }
.pere.gamer::after { content: "🎧"; position: absolute; top: -16%; left: 50%; transform: translateX(-50%); font-size: .62em; }

.bubble { position: relative; background: var(--surface); border-radius: 18px; padding: 10px 14px; font-weight: 700; box-shadow: 0 2px 0 var(--line); }
.bubble::before { content: ""; position: absolute; left: -6px; top: 50%; width: 14px; height: 14px; margin-top: -7px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
.arena .bubble { box-shadow: 0 0 0 1px var(--line); }

/* ---------- Progreso ---------- */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .name { font-size: 18px; }
.topbar .level { font-size: 12px; font-weight: 800; color: var(--primary); }
.xp { height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 5px 0 3px; }
.xp > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #FFC83D, #FF8A1F); }
.xp-label { font-size: 12px; font-weight: 700; color: var(--muted); }

.stars { display: inline-flex; gap: 1px; font-size: 16px; line-height: 1; color: #E5D8BD; letter-spacing: 1px; }
.stars .on { color: var(--gold); }
.arena .stars { color: #3A366A; }
.stars.xl { font-size: 64px; gap: 6px; }

.segs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; flex: 1; }
.segs i { height: 10px; border-radius: 999px; background: var(--line); }
.segs i.on { background: var(--primary); }
.segs i.bad { background: var(--bad); }
.segs i.now { background: var(--gold); }

.badge { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(120deg, #FFF3C4, #FFE08A); box-shadow: 0 3px 0 #E7B93A; color: #5B4300; }
.badge .medal { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: #fff; box-shadow: inset 0 0 0 3px #F5B700; }
.badge b { font-family: var(--font-display); font-weight: 600; font-size: 17px; display: block; }
.badge span { font-size: 13px; font-weight: 700; }

.iconbtn { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px; font-weight: 800; text-decoration: none; background: var(--surface); box-shadow: 0 2px 0 var(--line); color: var(--ink); }
.arena .iconbtn { background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Opciones de respuesta (Expedición) ---------- */
.q-text { font-family: var(--font-display); font-weight: 500; font-size: 23px; line-height: 1.3; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); font-family: var(--font-body); font-weight: 700; font-size: 18px; color: var(--ink); text-align: left; box-shadow: 0 3px 0 var(--line); }
.opt .key { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; background: #F3F4F6; color: #4B5563; }
.opt .mark { margin-left: auto; flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 900; color: #fff; }
.opt.is-selected { border-color: var(--accent); box-shadow: 0 3px 0 var(--accent); background: #ECFEFF; }
.opt.is-selected .key { background: var(--accent); color: #fff; }
.opt.is-correct { border-color: var(--ok); box-shadow: 0 3px 0 var(--ok); background: var(--ok-soft); color: #065F46; }
.opt.is-correct .key, .opt.is-correct .mark { background: var(--ok); color: #fff; }
.opt.is-wrong { border-color: var(--bad); box-shadow: 0 3px 0 var(--bad); background: var(--bad-soft); color: #991B1B; }
.opt.is-wrong .key, .opt.is-wrong .mark { background: var(--bad); color: #fff; }
.opt.is-dim { opacity: .5; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 430px; margin: 0 auto; padding: 18px 16px 20px; border-radius: 26px 26px 0 0; background: var(--surface); box-shadow: 0 -10px 30px rgba(31, 41, 55, .16); display: flex; flex-direction: column; gap: 12px; }
.sheet.ok { background: #ECFDF5; }
.sheet.bad { background: #FEF2F2; }
.sheet h3 { font-size: 22px; }
.sheet.ok h3 { color: #047857; }
.sheet.bad h3 { color: #B91C1C; }

/* ---------- Barra inferior ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; max-width: 430px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 12px 14px; background: var(--surface); border-top: 2px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 14px; font-weight: 800; font-size: 12px; color: var(--muted); text-decoration: none; }
.tabbar a .ico { font-size: 22px; line-height: 1.1; }
.tabbar a.active { color: var(--primary); background: rgba(14, 159, 110, .10); }
.arena .tabbar { background: #15132C; border-top: 1px solid var(--line); }
.arena .tabbar a.active { background: rgba(34, 211, 238, .12); }

/* ---------- Arena ---------- */
.neon-title { font-family: var(--font-display); font-weight: 700; font-size: 44px; letter-spacing: 3px; color: #fff; text-shadow: 0 0 10px #22D3EE, 0 0 28px #22D3EE, 0 0 52px #7C3AED; }

.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answer { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 108px; padding: 14px; border: 0; border-radius: 20px; font-family: var(--font-display); font-weight: 600; font-size: 20px; line-height: 1.15; color: #fff; text-align: left; box-shadow: 0 5px 0 rgba(0, 0, 0, .38); }
/* La figura se dibuja con CSS para que las cuatro tengan el mismo tamaño */
.answer .shape { display: block; width: 24px; height: 24px; font-size: 0; background: currentColor; }
.answer.a .shape { clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.answer.b .shape { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.answer.c .shape { border-radius: 50%; }
.answer.d .shape { border-radius: 5px; }
.answer.a { background: var(--ans-a); }
.answer.b { background: var(--ans-b); }
.answer.c { background: var(--ans-c); color: #3B2A00; }
.answer.d { background: var(--ans-d); }
.answer.is-picked { outline: 4px solid #fff; outline-offset: 2px; }
.answer.is-dim { opacity: .26; filter: saturate(.6); }
.answer.is-correct { box-shadow: 0 5px 0 rgba(0, 0, 0, .38), 0 0 0 4px #fff, 0 0 36px 8px rgba(74, 222, 128, .75); }
.answer .tag { align-self: flex-end; font-family: var(--font-body); font-weight: 900; font-size: 13px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: #166534; }

.players { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.player { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px 10px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--line); }
.player .avatar { width: 44px; height: 44px; font-size: 24px; }
.player .name { font-weight: 800; font-size: 13px; }
.player .state { font-size: 11px; font-weight: 800; color: var(--muted); }
.player .state.done { color: var(--ok); }
.player .pts { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--gold); }
.player .pts.zero { color: var(--muted); }
.player.me { box-shadow: 0 0 0 2px var(--primary), 0 0 18px rgba(34, 211, 238, .35); }

.timer { position: relative; flex: none; width: 60px; height: 60px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }

.code { display: flex; justify-content: center; gap: 10px; }
.code b { width: 64px; height: 78px; border-radius: 16px; display: grid; place-items: center; font-family: var(--font-display); font-size: 44px; font-weight: 700; color: #0F1020; background: var(--primary); box-shadow: 0 5px 0 var(--primary-press), 0 0 26px rgba(34, 211, 238, .5); }

.slot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 132px; padding: 12px 8px; border-radius: 20px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--line); text-align: center; }
.slot .name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.slot .tag { font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #3B2A00; }
.slot.empty { background: transparent; box-shadow: none; border: 2px dashed var(--line); color: var(--muted); font-weight: 800; font-size: 14px; }

.rank { display: flex; flex-direction: column; gap: 10px; }
.rank .line { display: grid; grid-template-columns: 26px 44px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(255, 255, 255, .06); box-shadow: 0 0 0 1px var(--line); }
.rank .line.me { box-shadow: 0 0 0 2px var(--primary), 0 0 18px rgba(34, 211, 238, .35); }
.rank .pos { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--muted); }
.rank .who b { display: block; font-weight: 800; font-size: 15px; }
.rank .bar { height: 10px; border-radius: 999px; background: #2A2750; overflow: hidden; margin-top: 5px; }
.rank .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #22D3EE, #A3E635); }
.rank .total { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.rank .delta { display: block; font-size: 12px; font-weight: 800; color: var(--ok); text-align: right; }

.podium { display: grid; grid-template-columns: 1fr 1.12fr 1fr; align-items: end; gap: 8px; }
.podium .col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium .who { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.podium .pts { font-size: 13px; font-weight: 800; color: var(--muted); }
.podium .block { width: 100%; border-radius: 16px 16px 6px 6px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 36px; color: #0F1020; }
.podium .p1 .block { height: 124px; background: linear-gradient(180deg, #FDE047, #F59E0B); box-shadow: 0 0 44px rgba(253, 224, 71, .5); }
.podium .p2 .block { height: 96px; background: linear-gradient(180deg, #E5E7EB, #9CA3AF); }
.podium .p3 .block { height: 76px; background: linear-gradient(180deg, #FDBA74, #C2410C); }

.reactions { display: flex; justify-content: center; gap: 8px; }
.reactions span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 1px var(--line); }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
/* El confeti queda detrás del contenido */
.confetti ~ * { position: relative; z-index: 1; }
.confetti i { position: absolute; width: 10px; height: 16px; border-radius: 3px; opacity: .9; }

/* ---------- Mapa (inicio de la Expedición) ---------- */
.map { position: relative; padding: 10px; background: linear-gradient(180deg, #CFF1F3, #BDE9EE); overflow: hidden; }
.map svg { display: block; width: 100%; height: auto; }
.pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; }
.pin .dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; line-height: 1; background: var(--c); box-shadow: 0 0 0 4px #fff, 0 5px 0 4px rgba(31, 41, 55, .18); }
.pin .lbl { padding: 2px 8px; border-radius: 10px; background: #fff; font-size: 11px; font-weight: 900; line-height: 1.25; text-align: center; color: var(--ink); box-shadow: 0 2px 0 rgba(31, 41, 55, .12); }
.pin .lbl b { color: var(--c); }
.pin.now .dot { animation: pulso 1.6s ease-in-out infinite; }
@keyframes pulso { 0%, 100% { box-shadow: 0 0 0 4px #fff, 0 0 0 4px rgba(255, 138, 31, .55); } 50% { box-shadow: 0 0 0 4px #fff, 0 0 0 14px rgba(255, 138, 31, 0); } }

/* ---------- Camino de paradas (región) ---------- */
.path { position: relative; display: flex; flex-direction: column; gap: 18px; padding: 4px 0; }
.path::before { content: ""; position: absolute; left: 50%; top: 30px; bottom: 30px; border-left: 4px dotted #E5D8BD; }
.node { position: relative; display: flex; align-items: center; gap: 12px; width: 62%; }
.node:nth-child(odd) { align-self: flex-start; }
.node:nth-child(even) { align-self: flex-end; flex-direction: row-reverse; text-align: right; }
.node .dot { flex: none; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; line-height: 1; background: var(--c); box-shadow: 0 0 0 5px #fff, 0 6px 0 5px rgba(31, 41, 55, .16); }
.node .t { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.15; }
.node.now .dot { box-shadow: 0 0 0 5px #fff, 0 0 0 10px var(--gold), 0 6px 0 10px rgba(31, 41, 55, .12); }
.node.boss .dot { background: #1B1140; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Muestras del sistema (tarjetas de componentes) ---------- */
.world { background: var(--bg); color: var(--ink); padding: 20px; border-radius: 24px; }
.arena.world { background: radial-gradient(90% 60% at 50% -10%, rgba(124, 58, 237, .5), rgba(124, 58, 237, 0) 70%), linear-gradient(180deg, #0F1020, #1B1140); }
.sheet-page { max-width: 760px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.sw { border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-size: 12px; font-weight: 800; }
.sw i { display: block; height: 56px; background: var(--sw); }
.sw span { display: block; padding: 6px 8px 8px; line-height: 1.25; }
.sw code { display: block; font-family: ui-monospace, Menlo, monospace; font-weight: 600; font-size: 11px; color: var(--muted); }
.label { font-size: 12px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
