/* Fase 134: subir de nível na arena.
   O selo do nível é a peça memorável: um disco de ouro com o número que "rola" do nível atual
   para o novo (como um contador mecânico), raios na cor da classe (--hue) e faíscas. O resto da
   janela é quieto: a lista do que ganhou entra em sequência e as escolhas são cartões simples. */

/* No cartão: a faixa "Subir de nível" logo abaixo do nome, com um brilho que passa devagar. */
.ftr-lvl-cta {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 8px 14px; border-radius: var(--r-m); cursor: pointer; text-align: left;
  border: 1px solid transparent; color: var(--on-gold); font: inherit;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  box-shadow: 0 6px 20px var(--gold-glow), inset 0 1px 0 rgb(255 255 255 / 0.45);
  animation: ftr-glow 2.4s ease-in-out infinite;
}
.ftr-lvl-cta svg { width: 22px; height: 22px; flex: none; }
.ftr-lvl-cta .grow { display: flex; flex-direction: column; min-width: 0; }
.ftr-lvl-cta strong { font: 700 15px/1.2 var(--f-titulo); letter-spacing: 0.03em; }
.ftr-lvl-cta small { font: 600 12.5px/1.3 var(--f-ui); opacity: 0.8; }
.ftr-lvl-cta::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / 0.55) 50%, transparent 65%);
  transform: translateX(-120%); animation: lvl-shine 3.2s ease-in-out infinite 0.8s;
}
.ftr-lvl-cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.ftr-lvl-cta.reveal {
  color: var(--text); background: var(--surface-2); border-color: var(--gold-lo);
  box-shadow: 0 0 0 3px var(--gold-soft); animation: none;
}
.ftr-lvl-cta.reveal::after { display: none; }
.ftr-lvl-cta.reveal svg { color: var(--gold); }
@keyframes lvl-shine { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }
.ftr-level.just-up { animation: lvl-tag-pop 1.1s var(--ease) 2; }
@keyframes lvl-tag-pop {
  0% { transform: scale(1); box-shadow: 0 0 0 0 var(--gold-glow); }
  35% { transform: scale(1.35); box-shadow: 0 0 0 8px var(--gold-soft); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}
.ftr-sheet-cta { margin-bottom: 4px; }
.arena-lvl-note { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.arena-lvl-note svg { width: 18px; height: 18px; color: var(--gold); flex: none; }

/* A janela: tela cheia no celular, cartão alto no desktop. */
body.lvl-open { overflow: hidden; }
.lvl-backdrop {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: stretch; justify-content: center;
  background: var(--scrim); animation: fade 0.2s ease-out;
}
.lvl {
  --hue: var(--gold-lo);
  position: relative; display: flex; flex-direction: column; width: 100%; max-width: 560px; height: 100dvh;
  background:
    radial-gradient(120% 55% at 50% 0%, color-mix(in srgb, var(--hue) 26%, transparent), transparent 70%),
    var(--bg);
  overflow: hidden;
}
@media (min-width: 720px) {
  .lvl-backdrop { align-items: center; }
  .lvl { height: min(860px, 94dvh); border-radius: var(--r-xl); border: 1px solid var(--line); box-shadow: var(--shadow-2); }
}
.lvl-top { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter) 0; }
.lvl-steps { flex: 1; display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.lvl-steps li { flex: 1; height: 4px; border-radius: 4px; background: var(--line); transition: background-color 0.3s; }
.lvl-steps li.done { background: var(--gold-lo); }
.lvl-steps li.on { background: linear-gradient(90deg, var(--gold-lo), var(--hue)); }
.lvl-x {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer;
}
.lvl-x svg { width: 22px; height: 22px; }
.lvl-x:focus-visible { outline: 2px solid var(--gold-lo); }

.lvl-stage {
  --size: 168px;
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px var(--gutter) 6px;
}
.lvl-stage.compact { --size: 84px; flex-direction: row; justify-content: center; gap: 18px; padding-top: 14px; }
.lvl-title { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
.lvl-stage.compact .lvl-title { align-items: flex-start; text-align: left; }
.lvl-title h2 { margin: 0; font: 700 30px/1.1 var(--f-titulo); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.lvl-stage.compact .lvl-title h2 { font-size: 24px; }
.lvl-eyebrow { font: 700 11.5px/1.3 var(--f-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }

/* O selo */
.lvl-seal { position: relative; width: var(--size); height: var(--size); flex: none; }
.lvl-rays {
  position: absolute; inset: -46%; border-radius: 50%; opacity: 0; transform: scale(0.5) rotate(-20deg);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--hue) 70%, transparent) 0deg 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%);
}
.lvl-disc {
  position: absolute; inset: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(circle closest-side, color-mix(in srgb, var(--hue) 30%, var(--surface)) 0 80%, color-mix(in srgb, var(--hue) 55%, #000) 81% 83%, transparent 84%),
    conic-gradient(from 210deg, var(--gold-hi), var(--gold-lo), #8a5a17, var(--gold-hi), var(--gold-lo), var(--gold-hi));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hue) 55%, transparent), 0 14px 34px rgb(0 0 0 / 0.35), inset 0 2px 0 rgb(255 255 255 / 0.4);
}
.lvl-disc-label { font: 700 calc(var(--size) * 0.08)/1 var(--f-ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text); opacity: 0.8; }
.lvl-flip { position: relative; height: calc(var(--size) * 0.46); width: 100%; overflow: hidden; perspective: 300px; }
.lvl-flip b {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 700 calc(var(--size) * 0.42)/1 var(--f-titulo); color: var(--text);
  text-shadow: 0 2px 0 rgb(255 255 255 / 0.25), 0 0 18px color-mix(in srgb, var(--hue) 60%, transparent);
  backface-visibility: hidden; transform-origin: 50% 50%;
}
.lvl-new { transform: translateY(100%) rotateX(-80deg); opacity: 0; }
.lvl-seal.go .lvl-old { animation: lvl-out 0.55s cubic-bezier(0.5, 0, 0.75, 0) 0.45s forwards; }
.lvl-seal.go .lvl-new { animation: lvl-in 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) 0.85s forwards; }
.lvl-seal.go .lvl-rays { animation: lvl-rays 1.6s var(--ease) 0.75s forwards, lvl-spin 18s linear 2.35s infinite; }
.lvl-seal.go .lvl-disc { animation: lvl-thump 0.6s var(--ease) 0.85s; }
.lvl-seal.flipped .lvl-old, .lvl-seal.reveal .lvl-old { opacity: 0; }
.lvl-seal.flipped .lvl-new, .lvl-seal.reveal .lvl-new { transform: none; opacity: 1; }
.lvl-seal.flipped .lvl-rays, .lvl-seal.reveal .lvl-rays { opacity: 0.75; transform: scale(1); }
.lvl-seal.reveal.go .lvl-rays { animation: lvl-rays 1.2s var(--ease) forwards, lvl-spin 18s linear 1.2s infinite; }
.lvl-seal.reveal.go .lvl-disc { animation: lvl-thump 0.6s var(--ease) 0.2s; }
.lvl-seal.reveal.go .lvl-sparks i { animation-delay: calc(0.2s + var(--t)); }
@keyframes lvl-out { to { transform: translateY(-100%) rotateX(80deg); opacity: 0; } }
@keyframes lvl-in { from { transform: translateY(100%) rotateX(-80deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes lvl-rays { 0% { opacity: 0; transform: scale(0.5) rotate(-20deg); } 45% { opacity: 1; } 100% { opacity: 0.75; transform: scale(1) rotate(0deg); } }
@keyframes lvl-spin { from { transform: scale(1) rotate(0deg); } to { transform: scale(1) rotate(360deg); } }
@keyframes lvl-thump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.lvl-sparks { position: absolute; inset: 0; pointer-events: none; }
.lvl-sparks i {
  position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff 0 25%, var(--gold-hi) 40%, color-mix(in srgb, var(--hue) 80%, transparent) 70%);
}
.lvl-seal.go .lvl-sparks i { animation: lvl-spark 0.9s cubic-bezier(0.1, 0.7, 0.3, 1) calc(0.85s + var(--t)) forwards; }
@keyframes lvl-spark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(calc(var(--size) * 0.3)) scale(1.4); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(calc(var(--size) * 0.3 + var(--d))) scale(0.3); }
}

/* Corpo e rodapé */
.lvl-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px var(--gutter) 16px; display: flex; flex-direction: column; gap: 12px; }
.lvl-foot {
  flex: none; display: flex; flex-direction: column; gap: 6px;
  padding: 10px var(--gutter) calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line-soft);
  background: var(--bg);
}
.lvl-hint { min-height: 1.2em; text-align: center; color: var(--text-2); font-size: 13px; }
.lvl-hint:empty { display: none; }
.lvl-lead { margin: 6px 0 0; text-align: center; font: 500 20px/1.4 var(--f-prosa); }
.lvl.intro .lvl-stage { margin-top: auto; padding-bottom: 0; }
.lvl.intro .lvl-body { flex: none; margin-bottom: auto; padding-bottom: 40px; }
.lvl.intro .lvl-title h2 { font-size: 32px; }
.lvl-teaser { margin: 0; text-align: center; font: 600 14px/1.4 var(--f-ui); color: var(--gold); letter-spacing: 0.02em; }
.lvl-in { animation: fade-up 0.42s var(--ease) both; animation-delay: calc(var(--i, 0) * 120ms); }

.lvl-gains { display: flex; flex-direction: column; gap: 10px; }
.lvl-gain { padding: 12px 14px; border-radius: var(--r-m); background: var(--surface); border: 1px solid var(--line-soft); min-width: 0; }
.lvl-gain strong { font: 600 15px/1.3 var(--f-ui); }
.lvl-gain p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.lvl-line { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.lvl-delta { font: 700 15px var(--f-titulo); color: var(--gold); white-space: nowrap; }
.lvl-hp { display: flex; flex-direction: column; gap: 8px; border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.lvl-gain-head { display: flex; align-items: baseline; gap: 10px; }
.lvl-plus { font: 700 26px/1 var(--f-titulo); color: var(--ok); }
.lvl-hp small { font-size: 12.5px; color: var(--text-2); }
.lvl-hp-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.lvl-hp-bar b {
  display: block; height: 100%; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #3E9E72, #7CD9A8); animation: lvl-grow 1.1s var(--ease) 0.35s both;
}
@keyframes lvl-grow { from { width: var(--from, 0%); } to { width: 100%; } }
.lvl-trait { border-left: 3px solid var(--hue); }
.lvl-slots { display: flex; flex-direction: column; gap: 8px; }
.lvl-slot-rows { display: flex; flex-direction: column; gap: 6px; }
.lvl-slot-row { display: flex; align-items: center; gap: 10px; }
.lvl-slot-row small { min-width: 78px; color: var(--text-2); }
.lvl-pips { display: flex; gap: 5px; flex-wrap: wrap; }
.lvl-pips i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--arcane); background: var(--arcane-soft); }
.lvl-pips i.new { background: var(--arcane); box-shadow: 0 0 10px var(--arcane-line); animation: lvl-thump 0.5s var(--ease) 0.6s both; }
.lvl-next-note { margin: 2px 0 0; font-size: 14px; color: var(--text-2); text-align: center; }

.lvl-choice { display: flex; flex-direction: column; gap: 10px; }
.lvl-choice-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.lvl-choice h3, .lvl-review h3 { margin: 0; font: 600 18px/1.25 var(--f-titulo); }
.lvl-count { font-weight: 700; color: var(--gold); white-space: nowrap; }
.lvl-path {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--r-l);
  background: linear-gradient(180deg, color-mix(in srgb, var(--hue) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--hue) 45%, var(--line));
}
/* Fase 136: personalizada da conta (criada ou comprada): tinta arcana, borda tracejada de carta */
.lvl-path.custom {
  background: linear-gradient(180deg, var(--arcane-soft), var(--surface));
  border: 1.5px dashed var(--arcane-line);
}
.lvl-path.custom .lvl-eyebrow { color: var(--arcane); }
.lvl-path-desc { margin: 0; font-family: var(--f-prosa); font-style: italic; font-size: 16px; line-height: 1.35; color: var(--text-2); }
.lvl-path.on { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hue) 35%, transparent), 0 10px 26px var(--gold-glow); }
.lvl-path h3 { margin: 0; font: 700 22px/1.2 var(--f-titulo); overflow-wrap: anywhere; }
.lvl-path ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.lvl-path-btn[aria-pressed="true"] { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); color: var(--on-gold); border-color: transparent; }
.lvl-spells { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.lvl-spell {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 8px 12px;
  border-radius: var(--r-s); border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: 600 14px/1.25 var(--f-ui); text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.lvl-spell small { font-weight: 500; font-size: 12px; color: var(--text-2); }
.lvl-spell[aria-pressed="true"] { border-color: var(--arcane); background: var(--arcane-soft); box-shadow: inset 0 0 0 1px var(--arcane); }
.lvl-spell[disabled] { opacity: 0.45; cursor: not-allowed; }
.lvl-spell:focus-visible, .lvl-path-btn:focus-visible { outline: 2px solid var(--gold-lo); outline-offset: 2px; }
.lvl-review { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--r-l); background: var(--surface); border: 1px solid var(--line-soft); }
.lvl-review ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .ftr-lvl-cta, .ftr-level.just-up { animation: none; }
  .ftr-lvl-cta::after { display: none; }
}
.lvl-backdrop.still { animation: none; }
.lvl.still *, .lvl.still *::before, .lvl.still *::after { animation: none !important; transition: none !important; }
.lvl.still .lvl-old { opacity: 0; }
.lvl.still .lvl-new { transform: none; opacity: 1; }
.lvl.still .lvl-rays { opacity: 0.6; transform: none; }
.lvl-path li strong { display: block; }
