/* ============================================================
   ESTRELA ABISSAL — estilo da interface
   ============================================================ */
:root {
  --fundo: #07050f;
  --painel: rgba(18, 14, 32, 0.95);
  --painel2: rgba(34, 27, 58, 0.9);
  --borda: #c9a44c;
  --borda2: #4a3f6a;
  --texto: #f0ecff;
  --fraco: #a59ac8;
  --ouro: #ffe066;
  --roxo: #a66bff;
  --vida: #e0455a;
  --mana: #4a8aff;
  --ok: #7fe06a;
  --erro: #ff6a6a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fundo); color: var(--texto); font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif; font-size: 14px; user-select: none; -webkit-user-select: none; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
#tela { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: none; }
.oculto { display: none !important; }
button, input, select { font-family: inherit; font-size: inherit; }

/* ---------- Botões ---------- */
.btn { pointer-events: auto; cursor: pointer; background: linear-gradient(#2a2148, #1a1430); color: var(--texto); border: 1px solid var(--borda2); border-radius: 6px; padding: 8px 16px; transition: border-color .12s, box-shadow .12s, transform .08s; }
.btn:hover { border-color: var(--borda); box-shadow: 0 0 12px rgba(201, 164, 76, .35); }
.btn:active { transform: translateY(1px); }
.btn.ouro { border-color: var(--borda); color: var(--ouro); font-weight: 700; letter-spacing: .06em; }
.btn.perigo:hover { border-color: var(--erro); box-shadow: 0 0 12px rgba(255, 90, 90, .35); }
.btn.mini { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; border-color: var(--borda2); }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; }
#hud-status { position: absolute; left: 12px; top: 10px; display: flex; gap: 10px; align-items: flex-start; background: var(--painel); border: 1px solid var(--borda2); border-radius: 8px; padding: 8px 12px 8px 8px; }
#hud-classe { width: 48px; height: 48px; background: #0d0a18; border: 1px solid var(--borda); border-radius: 6px; }
#hud-nome { font-weight: 700; font-size: 13px; margin-bottom: 3px; white-space: nowrap; }
#hud-nome small { color: var(--fraco); font-weight: 400; }
.barra { position: relative; width: 190px; height: 14px; background: #0d0a18; border: 1px solid #2c2444; border-radius: 4px; overflow: hidden; margin-bottom: 3px; }
.barra i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; transition: width .12s; }
.barra span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.barra.hp i { background: linear-gradient(#ff6a7e, #c8324a); }
.barra.mana i { background: linear-gradient(#6aa4ff, #2f62d0); }
.barra.xp { height: 6px; }
.barra.xp i { background: linear-gradient(#ffe066, #c9a44c); }
#hud-buffs { display: flex; gap: 4px; flex-wrap: wrap; max-width: 190px; min-height: 0; }
.buff { font-size: 10px; padding: 1px 6px; border-radius: 9px; background: #2a2148; border: 1px solid var(--borda2); white-space: nowrap; }
.buff.mau { border-color: #a03a4a; color: #ffb0b8; }

#hud-direita { position: absolute; right: 12px; top: 10px; width: 190px; text-align: right; }
#minimapa { width: 190px; height: 118px; background: #0d0a18; border: 1px solid var(--borda2); border-radius: 6px; display: block; }
#hud-local { font-size: 12px; margin-top: 4px; font-weight: 700; text-shadow: 0 1px 3px #000; }
#hud-po { font-size: 13px; color: var(--ouro); font-weight: 700; text-shadow: 0 1px 3px #000; }
#hud-objetivo { margin-top: 6px; font-size: 12px; background: var(--painel); border: 1px solid var(--borda2); border-left: 3px solid var(--borda); border-radius: 6px; padding: 6px 8px; text-align: left; line-height: 1.35; }
#hud-objetivo b { color: var(--ouro); display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 2px; }
#hud-jogadores { margin-top: 6px; font-size: 11px; text-align: left; }
#hud-jogadores div { background: var(--painel); border-radius: 4px; padding: 2px 6px; margin-bottom: 2px; }

#hud-chefe { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: min(520px, 46vw); text-align: center; }
#hud-chefe .nome { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 2px 6px #000; margin-bottom: 4px; }
#hud-chefe .nome small { display: block; font-weight: 600; letter-spacing: .05em; text-transform: none; color: #e8e0ff; font-size: 11px; text-shadow: 0 1px 4px #000, 0 0 6px #000; margin-top: 1px; }
#hud-chefe .barra { width: 100%; height: 16px; border-color: var(--borda); }
#hud-chefe .barra i { background: linear-gradient(#ff5a8a, #8a2ad0); }

#hud-baixo { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 14px; align-items: flex-end; }
#hotbar, #hud-hab { display: flex; gap: 4px; background: var(--painel); border: 1px solid var(--borda2); border-radius: 8px; padding: 5px; }
.slot { position: relative; width: 42px; height: 42px; background: #100c1e; border: 1px solid #2c2444; border-radius: 5px; pointer-events: auto; flex: none; }
.slot img, .slot canvas { position: absolute; left: 4px; top: 4px; width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot .q { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 700; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.slot .ql { position: absolute; left: 3px; top: 0; font-size: 10px; font-weight: 800; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.slot .tecla { position: absolute; left: 3px; bottom: 1px; font-size: 9px; color: var(--fraco); pointer-events: none; }
.slot.sel { border-color: var(--ouro); box-shadow: 0 0 10px rgba(255, 224, 102, .5), inset 0 0 8px rgba(255, 224, 102, .15); }
.slot:hover { border-color: var(--borda); }
.slot.vazio-rotulo::after { content: attr(data-rotulo); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #5a4f80; text-align: center; pointer-events: none; }
.slot .cd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(8, 5, 16, .78); pointer-events: none; border-radius: 4px; }
.slot .cdn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; text-shadow: 0 0 4px #000; pointer-events: none; }
.slot.hab { width: 46px; height: 46px; }
.slot.hab img, .slot.hab canvas { left: 6px; top: 6px; }
.slot.sem-mana { filter: saturate(.3) brightness(.7); }
.q-sss { animation: brilhoSSS 1.2s linear infinite; }
@keyframes brilhoSSS { 0% { color: #ffe066; } 33% { color: #ff8ad8; } 66% { color: #7fe0ff; } 100% { color: #ffe066; } }

#hud-log { position: absolute; left: 12px; bottom: 12px; width: 260px; display: flex; flex-direction: column-reverse; gap: 2px; font-size: 12px; }
#hud-log div { background: rgba(12, 9, 22, .7); border-radius: 4px; padding: 2px 8px; animation: sumir 4.5s forwards; width: fit-content; }
#hud-log img { width: 16px; height: 16px; vertical-align: -3px; image-rendering: pixelated; margin-right: 4px; }
@keyframes sumir { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#hud-aviso { position: absolute; left: 50%; top: 84px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 80vw; }
#hud-aviso div { background: rgba(12, 9, 22, .82); border: 1px solid var(--borda2); border-radius: 14px; padding: 4px 16px; font-weight: 700; font-size: 13px; animation: avisoIn 3.4s forwards; text-shadow: 0 1px 2px #000; }
@keyframes avisoIn { 0% { opacity: 0; transform: translateY(-8px); } 8%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#hud-prompt { position: absolute; left: 50%; bottom: 152px; transform: translateX(-50%); background: var(--painel); border: 1px solid var(--borda); border-radius: 6px; padding: 5px 14px; font-weight: 700; }
#hud-prompt kbd, kbd { background: #2a2148; border: 1px solid var(--borda2); border-bottom-width: 2px; border-radius: 4px; padding: 0 6px; font-family: inherit; font-size: 12px; color: var(--ouro); }
#hud-ajuda { position: absolute; right: 12px; bottom: 12px; font-size: 11px; color: var(--fraco); text-align: right; line-height: 1.6; text-shadow: 0 1px 2px #000; }

/* Lume */
#lume { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); width: min(560px, 80vw); display: flex; gap: 10px; align-items: center; background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; padding: 8px 14px; pointer-events: auto; cursor: pointer; box-shadow: 0 0 24px rgba(255, 224, 102, .18); }
#lume .rosto { width: 34px; height: 34px; flex: none; border-radius: 50%; background: radial-gradient(#fff8d8, #ffe066 35%, rgba(255, 224, 102, 0) 70%); animation: pulsar 1.6s ease-in-out infinite; }
#lume .nome { color: var(--ouro); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; }
#lume .txt { font-size: 14px; line-height: 1.4; min-height: 38px; }
@keyframes pulsar { 50% { transform: scale(1.18); opacity: .8; } }

/* Chat */
#chat { position: absolute; left: 12px; bottom: 130px; width: 300px; font-size: 12px; }
#chat .msgs div { background: rgba(12, 9, 22, .7); border-radius: 4px; padding: 2px 8px; margin-top: 2px; width: fit-content; max-width: 100%; word-break: break-word; }
#chat .msgs b { color: var(--ouro); }
#chat input { pointer-events: auto; width: 100%; margin-top: 4px; background: var(--painel); color: var(--texto); border: 1px solid var(--borda); border-radius: 5px; padding: 5px 8px; outline: none; }

/* ---------- Painéis ---------- */
#paineis { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.painel { pointer-events: auto; background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 10px 50px rgba(0, 0, 0, .7), inset 0 0 40px rgba(166, 107, 255, .06); max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; }
.painel > header { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 1px solid var(--borda2); }
.painel > header h2 { margin: 0; font-size: 15px; letter-spacing: .18em; text-transform: uppercase; color: var(--ouro); }
.painel > header .x { pointer-events: auto; cursor: pointer; width: 26px; height: 26px; line-height: 24px; text-align: center; border-radius: 5px; border: 1px solid var(--borda2); background: none; color: var(--texto); }
.painel > header .x:hover { border-color: var(--erro); color: var(--erro); }
.painel .corpo { padding: 12px 14px; overflow: auto; display: flex; gap: 14px; }
.col { display: flex; flex-direction: column; gap: 8px; }
h3 { margin: 0 0 2px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--fraco); font-weight: 700; }
.grade { display: grid; grid-template-columns: repeat(8, 42px); gap: 4px; }
.linha { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sep { height: 1px; background: var(--borda2); margin: 4px 0; }
.dica { font-size: 11px; color: var(--fraco); line-height: 1.5; }
.stats { font-size: 12px; display: grid; grid-template-columns: auto auto; gap: 2px 14px; }
.stats b { text-align: right; color: var(--ouro); font-weight: 700; }
#previa { width: 96px; height: 120px; background: radial-gradient(#2a2148, #0d0a18); border: 1px solid var(--borda2); border-radius: 6px; }

/* Fabricação */
.abas { display: flex; gap: 4px; flex-wrap: wrap; }
.aba { pointer-events: auto; cursor: pointer; padding: 3px 9px; font-size: 11px; border-radius: 12px; background: #1a1430; border: 1px solid var(--borda2); color: var(--fraco); }
.aba.sel { border-color: var(--borda); color: var(--ouro); }
#receitas { width: 330px; height: 330px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; }
.rec { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; border: 1px solid transparent; background: #15102a; cursor: pointer; opacity: .5; }
.rec.ok { opacity: 1; border-color: #2c2444; }
.rec.ok:hover { border-color: var(--borda); background: #1e1638; }
.rec img.ic { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.rec .n { font-size: 12px; font-weight: 700; }
.rec .ing { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--fraco); }
.rec .ing img { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: -3px; }
.rec .ing .falta { color: var(--erro); }
.rec .ing .tem { color: var(--ok); }
.est { font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--borda2); color: var(--fraco); }
.est.on { border-color: var(--ok); color: var(--ok); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--borda2); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* Tooltip */
#tooltip { position: absolute; z-index: 50; max-width: 270px; background: rgba(10, 7, 20, .97); border: 1px solid var(--borda); border-radius: 7px; padding: 8px 10px; font-size: 12px; line-height: 1.45; box-shadow: 0 6px 24px rgba(0, 0, 0, .7); }
#tooltip .tn { font-weight: 800; font-size: 13px; }
#tooltip .ts { color: var(--fraco); font-size: 11px; }
#tooltip .tq { display: inline-block; font-weight: 800; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-right: 5px; font-size: 11px; }
#tooltip .st { color: #d8d0f8; }
#tooltip .bn { color: var(--ok); }
#tooltip .td { color: var(--fraco); font-style: italic; margin-top: 4px; }
#tooltip .ta { color: var(--ouro); font-size: 11px; margin-top: 4px; }
#cursor-item { position: absolute; z-index: 60; width: 32px; height: 32px; }
#cursor-item img { width: 32px; height: 32px; image-rendering: pixelated; }

/* Personagem */
.classes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cls { pointer-events: auto; cursor: pointer; text-align: center; background: #15102a; border: 1px solid #2c2444; border-radius: 8px; padding: 8px 4px 6px; transition: border-color .12s, transform .1s; min-width: 84px; }
.cls:hover { border-color: var(--borda); transform: translateY(-2px); }
.cls.sel { border-color: var(--c, var(--ouro)); box-shadow: 0 0 14px color-mix(in srgb, var(--c, #ffe066) 45%, transparent), inset 0 0 14px color-mix(in srgb, var(--c, #ffe066) 12%, transparent); }
.cls canvas { width: 40px; height: 40px; }
.cls .n { font-weight: 800; font-size: 12px; color: var(--c, var(--texto)); }
.cls .v { font-size: 10px; color: var(--fraco); }
.atr { display: grid; grid-template-columns: 96px 34px auto; align-items: center; gap: 4px 8px; font-size: 13px; }
.atr b { text-align: right; color: var(--ouro); }
.hab-card { background: #15102a; border: 1px solid #2c2444; border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.4; }
.hab-card b { color: var(--ouro); }
.hab-card small { color: var(--fraco); }

/* Forja */
#forja-centro { width: 300px; text-align: center; }
#forja-letra { font-size: 64px; font-weight: 900; line-height: 1; text-shadow: 0 0 24px currentColor; margin: 6px 0; min-height: 66px; }
#forja-letra.gira { animation: tremer .08s linear infinite; }
@keyframes tremer { 0% { transform: translate(-1px, 1px) rotate(-2deg); } 50% { transform: translate(1px, -1px) rotate(2deg); } 100% { transform: translate(-1px, -1px); } }
.chances { display: grid; grid-template-columns: 34px 1fr 44px; gap: 2px 6px; font-size: 11px; align-items: center; text-align: left; }
.chances i { display: block; height: 7px; border-radius: 3px; min-width: 1px; }
#forja-res { min-height: 20px; font-weight: 800; }

/* Mapa e diário */
#mapa-c { background: #06040c; border: 1px solid var(--borda2); border-radius: 6px; cursor: grab; display: block; }
.jornada { display: flex; flex-direction: column; gap: 4px; width: 360px; }
.jor { display: flex; gap: 10px; align-items: center; background: #15102a; border: 1px solid #2c2444; border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.jor canvas { width: 40px; height: 40px; flex: none; }
.jor.feito { border-color: var(--ok); }
.jor .t { font-weight: 800; }
.jor small { color: var(--fraco); display: block; }
.jor .chk { margin-left: auto; font-size: 16px; color: var(--ok); }

/* ---------- Tela de título ---------- */
#titulo { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; background: radial-gradient(ellipse at 50% 30%, rgba(60, 30, 110, .25), rgba(7, 5, 15, .0) 60%); }
#logo { text-align: center; margin-bottom: 26px; }
#logo h1 { margin: 0; font-size: clamp(34px, 6.4vw, 78px); letter-spacing: .26em; margin-right: -.26em; font-weight: 900; background: linear-gradient(180deg, #fff6c8 0%, #ffe066 38%, #b574ff 78%, #5a2ad0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 22px rgba(166, 107, 255, .55)); }
#logo p { margin: 6px 0 0; color: var(--fraco); letter-spacing: .5em; text-transform: uppercase; font-size: 12px; }
#menu { display: flex; flex-direction: column; gap: 8px; width: 260px; }
#menu .btn { padding: 11px; font-size: 15px; letter-spacing: .08em; }
#titulo .rodape { position: absolute; bottom: 10px; font-size: 11px; color: #6a5f90; }
.tela { pointer-events: auto; background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; padding: 16px 20px; max-width: min(900px, 96vw); max-height: 92vh; overflow: auto; }
.tela h2 { margin: 0 0 12px; font-size: 16px; letter-spacing: .18em; text-transform: uppercase; color: var(--ouro); }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.campo label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fraco); }
.campo input[type=text] { pointer-events: auto; background: #0d0a18; color: var(--texto); border: 1px solid var(--borda2); border-radius: 6px; padding: 8px 10px; outline: none; user-select: text; -webkit-user-select: text; }
.campo input[type=text]:focus { border-color: var(--borda); }
.difs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dif { pointer-events: auto; cursor: pointer; background: #15102a; border: 1px solid #2c2444; border-radius: 8px; padding: 8px; font-size: 11px; line-height: 1.4; color: var(--fraco); }
.dif b { display: block; font-size: 13px; color: var(--c); margin-bottom: 2px; }
.dif.sel { border-color: var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.cores { display: flex; gap: 5px; }
.cor { pointer-events: auto; cursor: pointer; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #2c2444; }
.cor.sel { border-color: var(--ouro); }
.slots-save { display: flex; flex-direction: column; gap: 8px; min-width: 420px; }
.save { display: flex; align-items: center; gap: 12px; background: #15102a; border: 1px solid #2c2444; border-radius: 8px; padding: 10px 12px; }
.save.sel { border-color: var(--borda); }
.save .inf { flex: 1; font-size: 12px; color: var(--fraco); line-height: 1.5; }
.save .inf b { color: var(--texto); font-size: 14px; }
.save canvas { width: 40px; height: 40px; }
.controles { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 13px; align-items: center; }
input[type=range] { pointer-events: auto; accent-color: #c9a44c; width: 180px; }
input[type=checkbox] { pointer-events: auto; accent-color: #c9a44c; }

/* ---------- Cinemática, morte, anúncios ---------- */
#cine { position: absolute; inset: 0; background: rgba(4, 2, 10, .93); display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: auto; cursor: pointer; z-index: 80; }
#cine .linha-c { max-width: 760px; text-align: center; font-size: clamp(17px, 2.3vw, 26px); line-height: 1.6; white-space: pre-line; padding: 0 24px; animation: surgir 1.4s ease-out; text-shadow: 0 0 18px rgba(166, 107, 255, .5); }
#cine .pular { position: absolute; bottom: 22px; color: var(--fraco); font-size: 12px; letter-spacing: .1em; }
@keyframes surgir { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#morte { position: absolute; inset: 0; background: radial-gradient(rgba(90, 10, 20, .35), rgba(10, 2, 6, .85)); display: flex; flex-direction: column; align-items: center; justify-content: center; animation: surgir .6s; }
#morte h1 { font-size: 46px; letter-spacing: .3em; margin: 0; color: #ff6a7e; text-shadow: 0 0 30px #a01030; }
#morte p { color: var(--fraco); }
#anuncio { position: absolute; left: 0; right: 0; top: 28%; text-align: center; animation: anuncio 3.6s forwards; }
#anuncio h1 { margin: 0; font-size: clamp(30px, 5vw, 60px); letter-spacing: .22em; font-weight: 900; color: var(--c, #fff); text-shadow: 0 0 30px var(--c, #fff), 0 4px 10px #000; }
#anuncio p { margin: 4px 0 0; letter-spacing: .3em; text-transform: uppercase; color: var(--texto); text-shadow: 0 2px 6px #000; }
@keyframes anuncio { 0% { opacity: 0; transform: scale(1.3); } 12%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; } }
#item-novo { position: absolute; left: 50%; top: 150px; transform: translateX(-50%); background: var(--painel); border: 1px solid var(--c, var(--borda)); border-radius: 10px; padding: 8px 18px 8px 10px; display: flex; gap: 12px; align-items: center; box-shadow: 0 0 26px color-mix(in srgb, var(--c, #c9a44c) 55%, transparent); animation: avisoIn 3.4s forwards; }
#item-novo img { width: 48px; height: 48px; image-rendering: pixelated; }
#item-novo .l { font-size: 34px; font-weight: 900; color: var(--c); text-shadow: 0 0 14px var(--c); }
#item-novo .n { font-weight: 800; color: var(--c); }
#item-novo small { color: var(--fraco); display: block; }
#carregando { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; background: var(--fundo); font-size: 16px; letter-spacing: .2em; color: var(--ouro); z-index: 90; }
#carregando small { color: var(--fraco); letter-spacing: .05em; }
@media (max-width: 1240px) { #hud-ajuda { display: none; } #hud-log { bottom: 70px; } }
@media (max-height: 640px) { .slot { width: 36px; height: 36px; } .slot img, .slot canvas { width: 28px; height: 28px; } .grade { grid-template-columns: repeat(8, 36px); } #receitas { height: 240px; } }

/* ============================================================
   Celular e tablet — controles de toque (body.toque)
   ============================================================ */
html, body { overscroll-behavior: none; }
#tela { touch-action: none; }
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
#hud-prompt { pointer-events: auto; cursor: pointer; }
#tooltip.cartao { pointer-events: auto; max-width: min(300px, 92vw); }
.cartao-acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cartao-acoes .btn { padding: 7px 14px; font-size: 13px; }
#toque-ctrl, #gire, #cursor-item .mao-txt { display: none; }

body.toque #toque-ctrl { display: block; position: absolute; inset: 0; pointer-events: none; }
body.toque.painel-aberto #toque-ctrl { display: none; }
body.toque #hud-ajuda, body.toque #hud-hab, body.toque .slot .tecla { display: none; }

/* direcional: o canto esquerdo inteiro responde ao polegar */
#toque-zona { position: absolute; left: 0; bottom: 54px; width: 38vw; height: 54vh; pointer-events: auto; touch-action: none; }
#toque-base { position: absolute; left: 26px; bottom: 70px; width: 116px; height: 116px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(240, 236, 255, .3); background: radial-gradient(rgba(166, 107, 255, .2), rgba(18, 12, 36, .4)); opacity: .55; transition: opacity .12s; }
#toque-base.ativo { opacity: .95; transition: none; }
#toque-manete { position: absolute; left: 31px; top: 31px; width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff6c8, #c9a44c 72%); box-shadow: 0 0 14px rgba(255, 224, 102, .45); }

/* botões de ação (polegar direito) */
.tq-botao { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--texto); font-weight: 800; font-size: 9.5px; letter-spacing: .08em; user-select: none; -webkit-user-select: none; cursor: pointer;
  background: radial-gradient(circle at 40% 35%, rgba(64, 48, 108, .93), rgba(16, 12, 30, .93)); border: 2px solid var(--borda); box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.tq-botao.on { transform: scale(.92); border-color: var(--ouro); box-shadow: 0 0 18px rgba(255, 224, 102, .55); }
#toque-atk { right: 16px; bottom: 62px; width: 84px; height: 84px; }
#toque-atk img { width: 38px; height: 38px; image-rendering: pixelated; margin-bottom: 1px; }
#toque-pulo { right: 110px; bottom: 56px; width: 62px; height: 62px; }
#toque-pulo b { font-size: 19px; line-height: 1; color: var(--ouro); }
#toque-habs { position: absolute; inset: 0; pointer-events: none; }
body.toque .slot.hab { position: absolute; width: 56px; height: 56px; border-radius: 50%; overflow: hidden; touch-action: none; cursor: pointer;
  border: 2px solid var(--borda2); background: rgba(16, 12, 30, .92); box-shadow: 0 3px 10px rgba(0, 0, 0, .45); }
body.toque .slot.hab img, body.toque .slot.hab canvas { left: 10px; top: 10px; }
body.toque .slot.hab.th0 { right: 18px; bottom: 156px; }
body.toque .slot.hab.th1 { right: 88px; bottom: 132px; }
body.toque .slot.hab.th2 { right: 166px; bottom: 122px; width: 50px; height: 50px; }
body.toque .slot.hab.th2 img { left: 7px; top: 7px; }
body.toque .slot.hab.th2 .q { right: 8px; bottom: 5px; }

/* menus rápidos (abaixo do quadro de vida; a posição exata vem do 15_toque.js) */
#toque-menu { position: absolute; left: 8px; top: 92px; display: flex; gap: 4px; pointer-events: auto; }
.tq-menu-btn { width: 42px; height: 42px; border-radius: 9px; background: var(--painel); border: 1px solid var(--borda2); touch-action: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 8.5px; color: var(--fraco); user-select: none; -webkit-user-select: none; }
.tq-menu-btn .ic { font-size: 17px; line-height: 1.15; }

/* HUD mais compacto para caber na tela do celular */
body.toque #hud-status { left: 8px; top: 6px; padding: 5px 8px 5px 5px; gap: 6px; }
body.toque #hud-classe { width: 34px; height: 34px; }
body.toque .barra { width: 140px; height: 12px; }
body.toque .barra span { font-size: 9px; line-height: 10px; }
body.toque .barra.xp { height: 5px; }
body.toque #hud-nome { font-size: 11px; margin-bottom: 2px; }
body.toque #hud-buffs { max-width: 140px; }
body.toque #hud-direita { right: 8px; top: 6px; width: 132px; }
body.toque #minimapa { width: 132px; height: 82px; }
body.toque #hud-local { display: none; }
body.toque #hud-po { font-size: 11px; margin-top: 3px; }
body.toque #hud-objetivo { position: fixed; left: 50%; top: 6px; transform: translateX(-50%); width: min(300px, 36vw); margin: 0; font-size: 11px; padding: 4px 8px;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
body.toque #hud.com-chefe #hud-objetivo { display: none; }
body.toque #hud-chefe { top: 6px; width: 40vw; }
body.toque #hud-chefe .nome { font-size: 11px; }
body.toque #lume { top: 72px; bottom: auto; left: calc(50% + 30px); width: min(300px, 38vw); padding: 6px 10px; gap: 8px; }
body.toque #lume .rosto { width: 24px; height: 24px; }
body.toque #lume .txt { font-size: 12px; min-height: 0; }
body.toque #hud-aviso { top: 150px; }
body.toque #hud-aviso div { font-size: 12px; padding: 3px 12px; }
body.toque #hud-log { left: 50%; bottom: 108px; transform: translateX(-50%); width: auto; align-items: center; }
body.toque #hud-log div:nth-child(n+4) { display: none; }
body.toque #hud-prompt { bottom: 62px; padding: 8px 16px; font-size: 13px; border-color: var(--ouro); box-shadow: 0 0 16px rgba(255, 224, 102, .35);
  white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
body.toque #hud-prompt::before { content: '👆 '; }
body.toque #hud-baixo { bottom: 5px; }
body.toque #hotbar { padding: 3px; gap: 3px; }
body.toque #hotbar .slot { width: 38px; height: 38px; }
body.toque #hotbar .slot img, body.toque #hotbar .slot canvas { left: 2px; top: 2px; width: 32px; height: 32px; }
body.toque #item-novo { top: 120px; }

/* item sendo movido na mochila: aviso no alto da tela */
body.toque #cursor-item { left: 50% !important; top: 8px !important; transform: translateX(-50%); width: auto; height: auto; display: flex; align-items: center; gap: 8px;
  background: var(--painel); border: 1px solid var(--ouro); border-radius: 10px; padding: 4px 12px 4px 4px; z-index: 70; }
body.toque #cursor-item .mao-txt { display: inline; font-size: 12px; font-weight: 700; color: var(--ouro); }

/* janelas no celular: as colunas quebram e a janela rola */
body.toque .painel { max-height: 96vh; max-width: 98vw; }
body.toque .painel .corpo { flex-wrap: wrap; justify-content: center; padding: 8px 10px; }
body.toque .painel > header { padding: 4px 10px; }
body.toque .painel > header .x { width: 34px; height: 34px; font-size: 16px; }
body.toque .tela { padding: 12px 14px; max-height: 96vh; }

/* celular em pé: pede para girar */
#gire { position: fixed; inset: 0; z-index: 95; background: rgba(7, 5, 15, .97); flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; padding: 24px; pointer-events: auto; color: var(--texto); }
#gire b { font-size: 20px; color: var(--ouro); letter-spacing: .1em; }
#gire span { color: var(--fraco); font-size: 14px; max-width: 280px; }
#gire .cel { width: 44px; height: 76px; border: 3px solid var(--ouro); border-radius: 9px; animation: girarCel 2.2s ease-in-out infinite; }
@keyframes girarCel { 0%, 25% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) { body.toque #gire { display: flex; } }

/* tela de título em telas baixas (celular deitado): logo à esquerda, menu à direita */
@media (max-height: 480px) and (orientation: landscape) {
  #titulo > div { flex-direction: row !important; gap: 34px; }
  #logo { margin: 0; text-align: left; }
  #logo h1 { font-size: 40px; width: min-content; line-height: 1.05; letter-spacing: .2em; margin-right: 0; }
  #logo p { margin-top: 8px; font-size: 10px; letter-spacing: .4em; }
  #menu { width: 230px; gap: 6px; }
  #menu .btn { padding: 8px; font-size: 13px; }
  #titulo .rodape { display: none; }
}
