:root {
  --roxo: #24172F;
  --verde: #347A4B;
  --amarelo: #E8B943;
  --vermelho: #A91F35;
  --creme: #F1EBDD;
  --madeira: #4a2c17;
  --madeira-escura: #2e1a0d;
  --ouro: #d4a957;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--roxo);
  color: var(--creme);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app { max-width: 440px; margin: 0 auto; padding: 16px 16px 96px; }

.topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.topo-dir { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; font-weight: 800; letter-spacing: 2px; color: var(--amarelo); }
.chip {
  background: rgba(232, 185, 67, 0.15); color: var(--amarelo); border: 1px solid var(--amarelo);
  padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 14px;
}

.tela h2 { margin: 0 0 8px; }
.tela h3 { margin: 24px 0 10px; }
.sub { color: rgba(241, 235, 221, 0.7); }
.pequeno { font-size: 13px; line-height: 1.4; }
.centro { text-align: center; }
.oculto { display: none !important; }

.aviso { background: var(--verde); padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; line-height: 1.4; }
.aviso-criador { background: var(--vermelho); }

.abas { display: flex; gap: 8px; margin-bottom: 16px; }
.aba {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--creme);
  border: 1px solid rgba(241, 235, 221, 0.3); font-size: 15px;
}
.aba.ativa { background: var(--creme); color: var(--roxo); font-weight: 700; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.form input:not([type="checkbox"]), .form select, .linha input {
  padding: 12px; border-radius: 10px; border: none; font-size: 16px;
  background: var(--creme); color: var(--roxo); width: 100%;
}
.form .check { flex-direction: row; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.4; }
.form .check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

.btn {
  padding: 14px; border: none; border-radius: 12px; cursor: pointer;
  background: var(--amarelo); color: var(--roxo);
  font-size: 16px; font-weight: 800; width: 100%;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-peq { width: auto; padding: 9px 14px; font-size: 14px; white-space: nowrap; flex: none; }

.link { background: none; border: none; color: var(--creme); text-decoration: underline; cursor: pointer; font-size: 14px; }

.msg { min-height: 20px; color: var(--amarelo); margin-top: 10px; line-height: 1.4; }
.msg.erro { color: #ff8a9a; }

.caixa {
  background: rgba(241, 235, 221, 0.07); border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.caixa p { margin: 6px 0; }
.clicavel { cursor: pointer; }
.linha { display: flex; gap: 8px; margin-top: 8px; }
.linha-entre { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.tag {
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: rgba(232, 185, 67, 0.18); color: var(--amarelo); white-space: nowrap;
}
.tag-ok { background: rgba(52, 122, 75, 0.4); color: #bfe8cb; }
.tag-off { background: rgba(241, 235, 221, 0.1); color: rgba(241, 235, 221, 0.5); }

.barra { height: 10px; background: rgba(241, 235, 221, 0.12); border-radius: 999px; overflow: hidden; margin: 10px 0 4px; }
.barra-cheia { height: 100%; width: 0; background: linear-gradient(90deg, var(--verde), var(--amarelo)); border-radius: 999px; transition: width .4s; }

/* ---------- Cartas ---------- */
.carta {
  margin: 12px auto 18px; width: 170px; height: 236px; border-radius: 16px;
  background: var(--vermelho); border: 3px solid var(--amarelo);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.carta.r-comum { background: #5a3d6b; border-color: var(--creme); }
.carta.r-rara { background: var(--verde); border-color: #9fe0b2; }
.carta.r-lendaria { background: linear-gradient(160deg, #b8860b, var(--amarelo)); border-color: #fff3c4; }
.carta.r-lendaria .carta-numero { color: var(--roxo); }
.carta.r-exclusiva { background: var(--vermelho); border-color: var(--amarelo); }
.carta-rotulo { text-transform: uppercase; letter-spacing: 2px; font-size: 13px; }
.carta-numero { font-size: 60px; font-weight: 800; color: var(--amarelo); }
.carta-raridade { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }

.ganhos { display: flex; gap: 12px; margin-bottom: 14px; }
.ganho {
  flex: 1; background: rgba(241, 235, 221, 0.08); border-radius: 12px; padding: 12px;
  display: flex; flex-direction: column; align-items: center;
}
.ganho .valor { font-size: 26px; font-weight: 800; color: var(--amarelo); }
.ganho .rotulo { font-size: 13px; }

/* ---------- Album ---------- */
.legenda { display: flex; gap: 12px; font-size: 12px; margin: 8px 0 12px; }
.legenda span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legenda .r-comum::before, .ponto.r-comum { background: var(--creme); }
.legenda .r-rara::before, .ponto.r-rara { background: #5fc27e; }
.legenda .r-lendaria::before, .ponto.r-lendaria { background: var(--amarelo); }
.ponto { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }

.colecao { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mini {
  aspect-ratio: 3 / 4; border-radius: 8px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-weight: 800; font-size: 14px;
  background: rgba(241, 235, 221, 0.05); color: rgba(241, 235, 221, 0.28);
  border: 1px dashed rgba(241, 235, 221, 0.2);
}
.mini.r-rara { border-color: rgba(95, 194, 126, 0.45); }
.mini.r-lendaria { border-color: rgba(232, 185, 67, 0.5); }
.mini.tem { color: var(--creme); border-style: solid; }
.mini.tem.r-comum { background: #5a3d6b; border-color: var(--creme); }
.mini.tem.r-rara { background: var(--verde); border-color: #9fe0b2; }
.mini.tem.r-lendaria { background: linear-gradient(160deg, #b8860b, var(--amarelo)); color: var(--roxo); border-color: #fff3c4; }
.mini.tem.r-exclusiva { background: var(--vermelho); color: var(--amarelo); border-color: var(--amarelo); }
.mini .qtd { font-size: 11px; font-weight: 600; }

.lista { list-style: none; padding: 0; margin: 0 0 12px; }
.lista li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid rgba(241, 235, 221, 0.08); font-size: 15px;
}
.pos { color: #8fe0a5; }
.neg { color: #ff9aa8; }

/* ---------- Passe ---------- */
.niveis { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.nivel {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: rgba(241, 235, 221, 0.05); border-radius: 12px; opacity: 0.6;
}
.nivel.liberado { opacity: 1; background: rgba(232, 185, 67, 0.12); }
.nivel.pego { opacity: 0.85; background: rgba(52, 122, 75, 0.18); }
.nivel-num {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  background: var(--roxo); border: 2px solid var(--amarelo); color: var(--amarelo);
}
.nivel-info { flex: 1; display: flex; flex-direction: column; }

/* ---------- Loja ---------- */
.kits { display: flex; gap: 10px; margin: 10px 0 12px; }
.kit {
  flex: 1; padding: 16px 12px; border-radius: 14px; text-align: center;
  background: rgba(241, 235, 221, 0.07); display: flex; flex-direction: column; gap: 4px;
}

/* ---------- Navegacao ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(20, 12, 27, 0.96); border-top: 1px solid rgba(241, 235, 221, 0.1);
}
.nav-btn {
  flex: 1; max-width: 110px; padding: 10px 4px; border: none; border-radius: 10px;
  background: transparent; color: rgba(241, 235, 221, 0.6); font-size: 14px; font-weight: 700; cursor: pointer;
}
.nav-btn.ativa { background: rgba(232, 185, 67, 0.16); color: var(--amarelo); }

/* ---------- Modal / folha / toast ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 14, 0.75);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-caixa {
  width: 100%; max-width: 380px; background: var(--roxo); border-radius: 18px; padding: 20px;
  border: 1px solid rgba(232, 185, 67, 0.4); max-height: 88vh; overflow: auto;
}
.folha-caixa { background: linear-gradient(180deg, #3a2414, var(--madeira-escura)); border: 2px solid var(--ouro); }
.folha-titulo { margin: 0; font-family: Georgia, "Times New Roman", serif; color: #f6e3b4; }
.opcoes { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.opcao {
  padding: 13px; border-radius: 12px; border: 2px solid var(--ouro); background: rgba(0, 0, 0, 0.25);
  color: var(--creme); font-size: 15px; text-align: left; cursor: pointer;
}
.opcao.certa { background: var(--verde); border-color: #9fe0b2; }
.opcao.errada { background: var(--vermelho); border-color: #ff9aa8; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60;
  background: var(--creme); color: var(--roxo); font-weight: 700; padding: 11px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); max-width: 90%; text-align: center;
}

/* ---------- Area do personagem ---------- */
.cena {
  position: relative; border-radius: 20px; overflow: hidden; margin: 0 -4px 18px;
  aspect-ratio: 625 / 880; background: #1d2a14;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); border: 2px solid rgba(212, 169, 87, 0.45);
}
.cena-arte { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: pointer; user-select: none; }
.cena-arte.toque { animation: toque .45s ease; }
@keyframes toque { 30% { transform: scale(1.03) rotate(-1deg); } 60% { transform: scale(0.99) rotate(1deg); } }

.cena svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* placa de madeira (fundo claro) */
.regiao { position: absolute; top: 10px; left: 8px; display: flex; align-items: center; gap: 3px; }
.regiao-placa {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 104px; padding: 4px 10px 5px; border-radius: 12px;
  background: linear-gradient(180deg, #f3e2bd, #ddc08d); color: var(--madeira);
  border: 3px solid var(--madeira); font-family: Georgia, serif; font-weight: 700; font-size: 16px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.regiao-placa .arvore { width: 20px; height: 20px; fill: #3f7a2a; stroke: #2f5a1f; stroke-width: 1; }
.seta {
  width: 36px; height: 36px; flex: none; border-radius: 50%; cursor: pointer; color: #f6e3b4;
  background: radial-gradient(circle at 40% 35%, #6b4426, var(--madeira-escura));
  border: 3px solid var(--ouro); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

.placa-btn {
  position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 12px; cursor: pointer; color: #f6e3b4;
  background: linear-gradient(180deg, #5a3820, var(--madeira-escura)); border: 2px solid var(--ouro);
  font-family: Georgia, serif; font-weight: 700; font-size: 12px; line-height: 1.15; text-align: left;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.placa-btn svg { width: 24px; height: 24px; }
.badge {
  position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; border-radius: 11px;
  background: var(--vermelho); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center;
  border: 2px solid #f6e3b4; font-family: system-ui, sans-serif;
}

/* barra de energia */
.energia {
  position: absolute; right: 10px; top: 24%; bottom: 26%; width: 44px;
  display: flex; flex-direction: column; align-items: center; background: none; border: none; padding: 0; cursor: pointer;
}
.coracao {
  width: 44px; height: 44px; border-radius: 50%; z-index: 1; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, #6b4426, var(--madeira-escura)); border: 3px solid var(--ouro);
}
.energia .coracao svg { width: 24px; height: 24px; fill: #e2384f; stroke: #ffd0d6; stroke-width: 1; }
.tubo {
  flex: 1; width: 24px; margin-top: -6px; border-radius: 0 0 14px 14px; position: relative; overflow: hidden;
  background: rgba(46, 26, 13, 0.85); border: 3px solid var(--ouro);
}
.tubo-cheio {
  position: absolute; left: 2px; right: 2px; bottom: 2px; border-radius: 10px; height: 0;
  background: linear-gradient(180deg, #ff5a6e, #b3122b); transition: height .6s;
}
.tubo-cheio.baixa { animation: pisca 1.2s infinite; }
@keyframes pisca { 50% { opacity: 0.45; } }

/* botoes redondos de madeira */
.botoes-esq { position: absolute; left: 8px; top: 30%; display: flex; flex-direction: column; gap: 12px; }
.redondo {
  display: flex; flex-direction: column; align-items: center; background: none; border: none; padding: 0; cursor: pointer;
}
.disco {
  width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #f6e3b4;
  background: radial-gradient(circle at 40% 35%, #6b4426, var(--madeira-escura)); border: 3px solid var(--ouro);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
}
.disco svg { width: 26px; height: 26px; }
.rotulo-madeira {
  margin-top: -6px; padding: 3px 9px; border-radius: 8px; font-size: 11px; font-weight: 700; color: #f6e3b4;
  background: var(--madeira-escura); border: 2px solid var(--ouro); white-space: nowrap;
}
.redondo:active .disco, .seta:active, .placa-btn:active { transform: scale(0.94); }

.rodape-cena {
  position: absolute; left: 8px; right: 8px; bottom: 10px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 6px;
}
.faixa {
  flex: 1; text-align: center; padding: 9px 10px; margin-bottom: 4px; border-radius: 12px;
  background: linear-gradient(180deg, #6b4426, var(--madeira-escura)); border: 3px solid var(--ouro);
  font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 700; color: #f6e3b4;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.balao {
  position: absolute; left: 22%; right: 20%; top: 15%; z-index: 2;
  background: #fffaf0; color: var(--madeira); font-weight: 700; font-size: 14px; line-height: 1.35;
  padding: 10px 12px; border-radius: 14px; border: 2px solid var(--madeira); text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}
.balao::after {
  content: ""; position: absolute; bottom: -10px; left: 45%; border: 8px solid transparent; border-top-color: var(--madeira);
}
.balao.pula { animation: pula .3s ease; }
@keyframes pula { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
