/* ECOS DE VELMORA — interface (fantasia sombria: escuro, couro, ouro velho) */
:root {
  --ouro: #d9a441; --ouro2: #f1cf85; --sangue: #b23a2c; --tinta: #efe3c8; --tinta2: #b8a684;
  --fundo: rgba(18, 13, 10, .78); --borda: rgba(217, 164, 65, .45);
  --serif: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --seguro-t: env(safe-area-inset-top, 0px); --seguro-d: env(safe-area-inset-right, 0px);
  --seguro-b: env(safe-area-inset-bottom, 0px); --seguro-e: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0a08; color: var(--tinta); font-family: var(--sans); }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#palco { position: fixed; inset: 0; }
#palco canvas { display: block; width: 100%; height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- telas ---------- */
.tela { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; }
#entrada { background: radial-gradient(ellipse at 50% 30%, rgba(59,42,79,.55), rgba(13,10,8,.92) 70%);
  display: flex; justify-content: center; align-items: safe center; overflow-y: auto; padding: 12px; touch-action: pan-y; }
@media (max-height: 560px) {
  .cartao-entrada { padding: 14px 20px 12px; }
  .cartao-entrada h1 { font-size: 26px; }
  .sub { margin: 0 0 8px; }
  .rotulo { margin: 8px 0 4px; }
  .botao-ouro { margin-top: 10px; padding: 10px; }
  .cartao-entrada .nota { display: none; }
}
#carregando { background: #0d0a08; z-index: 30; gap: 14px; place-content: center; }
#carregando .barra { width: 220px; height: 4px; background: #2a2018; border-radius: 2px; overflow: hidden; }
#carregando .barra i { display: block; height: 100%; width: 0; background: var(--ouro); transition: width .2s; }
.pre { font-size: 11px; letter-spacing: 5px; text-transform: uppercase; color: var(--ouro); text-align: center; }
.cartao-entrada { width: min(92vw, 400px); padding: 26px 26px 20px; background: rgba(18,13,10,.86); border: 1px solid var(--borda); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.cartao-entrada h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; letter-spacing: 2px; margin: 8px 0 0; text-align: center; color: var(--tinta); }
.cartao-entrada h1 b { color: var(--ouro2); font-weight: 400; }
.sub { font-family: var(--serif); font-style: italic; color: var(--tinta2); text-align: center; margin: 2px 0 18px; }
label { display: block; font-size: 13px; color: var(--tinta2); }
input { width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 8px; border: 1px solid #4a3b2a; background: #1d1611; color: var(--tinta); font: 16px var(--sans); outline: none; }
input:focus { border-color: var(--ouro); }
.rotulo { font-size: 13px; color: var(--tinta2); margin: 14px 0 6px; }
.cores { display: flex; flex-wrap: wrap; gap: 8px; }
.cores button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }
.cores button[aria-checked="true"] { border-color: var(--ouro2); transform: scale(1.12); }
.botao-ouro { display: block; width: 100%; margin-top: 18px; padding: 12px; border: 0; border-radius: 10px; background: linear-gradient(#e3b45a, #b8842c); color: #1d140b; font-weight: 700; letter-spacing: .5px; box-shadow: 0 4px 14px rgba(217,164,65,.25); }
.botao-ouro:disabled { opacity: .6; }
.botao-sec { display: block; width: 100%; margin-top: 10px; padding: 10px; border-radius: 10px; border: 1px solid var(--borda); background: transparent; color: var(--ouro2); }
.erro { color: #ff8a7a; font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.nota { font-size: 12px; color: var(--tinta2); line-height: 1.45; margin: 12px 0 0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud button, #hud .grupo, #hud .placar { pointer-events: auto; }
.quadro { position: absolute; background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px; padding: 7px 9px 8px; }
#eu-quadro { top: calc(10px + var(--seguro-t)); left: calc(10px + var(--seguro-e)); width: 230px; }
.nome-linha { display: flex; justify-content: space-between; align-items: center; font-family: var(--serif); font-size: 14px; margin-bottom: 4px; gap: 6px; white-space: nowrap; }
.estados { font-family: var(--sans); font-size: 11px; color: var(--ouro2); overflow: hidden; text-overflow: ellipsis; }
.barra { position: relative; height: 8px; background: rgba(0,0,0,.55); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.barra i { position: absolute; inset: 0 auto 0 0; width: 100%; transition: width .15s; }
.barra.vida { height: 15px; }
.barra.vida i { background: linear-gradient(#c0463a, #8a241b); }
.barra.vida.inimigo i { background: linear-gradient(#a8562c, #6c2c13); }
.barra.vida span { position: absolute; inset: 0; font-size: 11px; line-height: 15px; text-align: center; text-shadow: 0 1px 2px #000; }
.barra.impeto i { background: linear-gradient(#e08a2c, #a3561a); }
.barra.carga { height: 5px; }
.barra.carga i { background: linear-gradient(#ffe7a3, #d9a441); }
.barra.carga.cheia i { animation: brilho 1s infinite alternate; }
@keyframes brilho { to { filter: brightness(1.5); } }
.grupo { position: absolute; top: calc(98px + var(--seguro-t)); left: calc(10px + var(--seguro-e)); margin: 0; padding: 0; list-style: none; width: 170px; }
.grupo li { background: var(--fundo); border: 1px solid rgba(217,164,65,.25); border-radius: 8px; padding: 4px 7px 5px; margin-bottom: 5px; font-size: 12px; }
.grupo li .barra { height: 6px; }
.grupo li.caido { opacity: .7; }
.grupo li.caido .barra i { background: #555; }
.grupo li .falando { color: #9be37b; }
.faixa { position: absolute; top: calc(10px + var(--seguro-t)); left: 50%; transform: translateX(-50%); text-align: center; font-family: var(--serif); text-shadow: 0 2px 6px #000; }
#faixa-texto { display: block; font-size: 20px; letter-spacing: 1px; color: var(--ouro2); }
#faixa-sub { display: block; font-size: 13px; color: var(--tinta2); font-family: var(--sans); }
.alvo { top: calc(62px + var(--seguro-t)); left: 50%; transform: translateX(-50%); width: 260px; }
.alvo.elite { border-color: #e0b04a; box-shadow: 0 0 12px rgba(217,164,65,.35); }
.topo-direita { position: absolute; top: calc(10px + var(--seguro-t)); right: calc(10px + var(--seguro-d)); display: flex; gap: 6px; align-items: center; }
.pilula { pointer-events: auto; height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 4px; border-radius: 18px; background: var(--fundo); border: 1px solid var(--borda); color: var(--tinta); font-size: 13px; }
.pilula.redonda { width: 36px; padding: 0; justify-content: center; }
.pilula svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mic svg rect { fill: currentColor; stroke: none; }
.mic .risco { stroke: #ff7a6a; }
.mic.ligado { background: #2f6b3a; border-color: #7fcf6a; }
.mic.ligado .risco { display: none; }
.mic.falando { box-shadow: 0 0 0 3px rgba(127,207,106,.55); }
.vozes { position: absolute; top: calc(54px + var(--seguro-t)); right: calc(10px + var(--seguro-d)); list-style: none; margin: 0; padding: 0; pointer-events: auto; }
.vozes li { background: var(--fundo); border: 1px solid var(--borda); border-radius: 14px; padding: 3px 10px; font-size: 12px; margin-bottom: 4px; cursor: pointer; }
.vozes li.falando { border-color: #7fcf6a; color: #b9f0a6; }
.vozes li.mudo { opacity: .55; text-decoration: line-through; }

.grande { position: absolute; left: 50%; top: calc(70px + var(--seguro-t)); transform: translateX(-50%); width: auto; padding: 14px 28px; font-size: 17px; pointer-events: auto; }
.caido { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); text-align: center; background: rgba(30,8,6,.82); border: 1px solid #7a2a20; border-radius: 12px; padding: 14px 20px; width: min(86vw, 320px); }
.caido-titulo { font-family: var(--serif); font-size: 24px; color: #ff9a88; }
#caido-sub { font-size: 13px; color: var(--tinta2); margin-top: 4px; }
.placar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(18,13,10,.92); border: 1px solid var(--borda); border-radius: 14px; padding: 16px 18px; width: min(94vw, 620px); }
.placar h2 { font-family: var(--serif); font-weight: 400; color: var(--ouro2); margin: 0 0 8px; text-align: center; font-size: 26px; }
.placar table { width: 100%; border-collapse: collapse; font-size: 13px; }
.placar th { color: var(--tinta2); font-weight: 600; text-align: left; padding: 4px; border-bottom: 1px solid var(--borda); }
.placar td { padding: 5px 4px; border-bottom: 1px solid rgba(217,164,65,.15); }
.aviso { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px; padding: 8px 14px; font-size: 14px; max-width: 86vw; text-align: center; }
.dica-teclas { position: absolute; left: calc(12px + var(--seguro-e)); bottom: calc(84px + var(--seguro-b)); transition: opacity 1s; font-size: 11.5px; color: var(--tinta2); line-height: 1.5; text-shadow: 0 1px 2px #000; }

/* barra de ações (PC) */
.acoes { position: absolute; left: 50%; bottom: calc(14px + var(--seguro-b)); transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; }
.acao { position: relative; width: 56px; height: 56px; border-radius: 10px; background: rgba(18,13,10,.85); border: 1px solid var(--borda); display: grid; place-items: center; overflow: hidden; padding: 0; touch-action: none; }
.acao svg { width: 30px; height: 30px; fill: none; stroke: var(--tinta); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.acao .tecla { position: absolute; top: 2px; left: 4px; font-size: 10px; color: var(--ouro2); }
.acao .sombra { position: absolute; inset: 0; background: rgba(0,0,0,.65); transform-origin: bottom; transform: scaleY(0); }
.acao .seg { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 700; text-shadow: 0 1px 3px #000; }
.acao.sem { opacity: .45; }
.acao.ativo { border-color: var(--ouro2); box-shadow: 0 0 10px rgba(241,207,133,.45); }
.acao.pronta-suprema { border-color: var(--ouro2); animation: brilho .8s infinite alternate; }
.acao.apertado { transform: scale(.93); }

/* ---------- celular (toque) ---------- */
body.toque .dica-teclas { display: none; }
body.toque #eu-quadro { width: 190px; }
body.toque .acoes { left: auto; right: calc(10px + var(--seguro-d)); bottom: calc(10px + var(--seguro-b)); transform: none; width: 240px; height: 230px; display: block; }
body.toque .acao { position: absolute; width: 56px; height: 56px; border-radius: 50%; }
body.toque .acao .tecla { display: none; }
body.toque .acao[data-a="basico"] { width: 86px; height: 86px; right: 6px; bottom: 6px; }
body.toque .acao[data-a="basico"] svg { width: 42px; height: 42px; }
body.toque .acao[data-a="investida"] { right: 104px; bottom: 4px; }
body.toque .acao[data-a="escudo"] { right: 98px; bottom: 70px; }
body.toque .acao[data-a="grito"] { right: 56px; bottom: 112px; }
body.toque .acao[data-a="redemoinho"] { right: 0; bottom: 112px; }
body.toque .acao[data-a="esquiva"] { right: 166px; bottom: 4px; width: 50px; height: 50px; }
body.toque .acao[data-a="suprema"] { right: 154px; bottom: 66px; width: 50px; height: 50px; }
body.toque .acao[data-a="bloquear"] { right: 112px; bottom: 136px; width: 46px; height: 46px; }
body.toque .acao[data-a="postura"] { right: 4px; bottom: 176px; width: 46px; height: 46px; }
body.toque .grupo { width: 140px; }
.joystick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(217,164,65,.4); background: rgba(18,13,10,.3); }
.joystick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(217,164,65,.55); }
.btn-reanimar { position: absolute; left: 50%; bottom: calc(110px + var(--seguro-b)); transform: translateX(-50%); padding: 12px 18px; border-radius: 24px; border: 1px solid #7fcf6a; background: rgba(20,50,24,.88); color: #c9f5b6; font-weight: 700; touch-action: none; }
.btn-reanimar.ativo { background: rgba(47,107,58,.95); }

/* telas baixas (celular deitado) */
@media (max-height: 460px) {
  .aviso { top: 42%; font-size: 13px; }
  .grande { top: calc(48px + var(--seguro-t)); padding: 10px 20px; font-size: 15px; }
  #eu-quadro { width: 180px; padding: 5px 7px 6px; }
  .grupo { top: calc(82px + var(--seguro-t)); }
  #faixa-texto { font-size: 16px; }
  .alvo { top: calc(46px + var(--seguro-t)); width: 200px; padding: 4px 7px; }
  .pilula { height: 32px; } .pilula.redonda { width: 32px; }
  body.toque .acoes { transform: scale(.86); transform-origin: bottom right; }
}
@media (max-width: 700px) {
  .topo-direita { top: calc(56px + var(--seguro-t)); }
  .alvo { top: calc(104px + var(--seguro-t)); }
}
