@font-face { font-family: alagard; src: url(../assets/alagard.ttf) format('truetype'); font-display: block; }
:root { --gold: #f0c35a; --paper: #e9d9b6; --ink: #231a14; --red: #d42a2a; --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff; overscroll-behavior: none;
  font-family: alagard, 'Courier New', monospace; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
#touch { position: fixed; inset: 0; z-index: 2; touch-action: none; }
#stick { position: fixed; left: 0; top: 0; width: 140px; height: 140px; border-radius: 50%; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0 55%, rgba(255,255,255,.18) 56% 60%, transparent 61%); transition: opacity .12s; }
#stick.on { opacity: 1; }
#knob { position: absolute; left: 45px; top: 45px; width: 50px; height: 50px; border-radius: 50%; background: rgba(240,195,90,.55); border: 2px solid rgba(255,255,255,.5); }
#dmgflash { position: fixed; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 60px 20px rgba(220,0,0,.7); opacity: 0; transition: opacity .25s; }
#dmgflash.on { opacity: 1; transition: none; }
.hidden { display: none !important; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; padding: calc(8px + var(--safe-t)) 10px 0; }
.hud-top { display: flex; align-items: center; gap: 8px; }
.lvbox { width: 44px; height: 44px; border-radius: 10px; background: #2b1f1a; border: 2px solid var(--gold); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 2px 0 #000; }
.lvbox .lvl { font-size: 11px; color: var(--gold); }
.lvbox b { font-size: 20px; }
.bars { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.bar { position: relative; height: 16px; background: rgba(0,0,0,.65); border: 2px solid #3a2c24; border-radius: 6px; overflow: hidden; }
.bar.xp { height: 12px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform-origin: 0 50%; transition: transform .15s; }
.bar.hp i { background: linear-gradient(#e24a3a, #a51d1d); }
.bar.xp i { background: linear-gradient(#63c3ff, #2466c9); transform: scaleX(0); }
.bar span { position: absolute; inset: 0; font-size: 11px; line-height: 12px; text-align: center; text-shadow: 1px 1px 0 #000; }
.bar.xp span { font-size: 9px; line-height: 8px; }
.icon-btn { pointer-events: auto; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--gold); background: #2b1f1a; color: #fff; font: 18px alagard, monospace; box-shadow: 0 2px 0 #000; }
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.hud-row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip { background: rgba(0,0,0,.55); border-radius: 8px; padding: 3px 8px; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.chip b { color: var(--gold); font-weight: normal; }
.weapons .chip { padding: 2px 6px; }
.ico { width: 16px; height: 16px; image-rendering: pixelated; }
.ico.big { width: 28px; height: 28px; }
.potion { position: fixed; right: 14px; bottom: calc(18px + var(--safe-b)); width: 70px; height: 70px; border-radius: 50%; pointer-events: auto;
  background: rgba(43,31,26,.85); border: 3px solid var(--gold); color: #fff; font-family: alagard, monospace; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; z-index: 6; box-shadow: 0 3px 0 #000; }
.potion b { position: absolute; top: 4px; right: 8px; font-size: 14px; color: var(--gold); font-weight: normal; }
.potion small { font-size: 11px; }
.potion.empty { opacity: .45; }
.potion:active { transform: translateY(2px); }
#toast { position: fixed; left: 50%; top: 32%; transform: translateX(-50%); z-index: 7; background: rgba(0,0,0,.7); border: 2px solid var(--gold); padding: 8px 14px; border-radius: 10px; font-size: 18px; text-align: center; pointer-events: none; animation: fadeio 2.2s forwards; }
#lvup { position: fixed; left: 0; right: 0; top: 40%; text-align: center; z-index: 7; font-size: 40px; color: var(--gold); text-shadow: 3px 3px 0 #000, 0 0 18px rgba(255,200,60,.8); pointer-events: none; animation: pop 1.4s forwards; }
@keyframes fadeio { 0% { opacity: 0 } 10% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0 } 15% { transform: scale(1.15); opacity: 1 } 30% { transform: scale(1) } 80% { opacity: 1 } 100% { opacity: 0; transform: translateY(-30px) } }

/* Telas */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; padding-top: calc(20px + var(--safe-t));
  background: #140c10 url(../assets/rooms.png) 0 0 / 500% auto; image-rendering: pixelated; }
.screen::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(20,12,16,.35), rgba(10,6,8,.92) 75%); }
.screen > * { position: relative; }
.screen.dim { background: rgba(0,0,0,.55); }
.screen.dim::before { display: none; }
.title-wrap { text-align: center; }
h1 { font-size: 56px; margin: 0; color: var(--gold); font-weight: normal; letter-spacing: 1px; text-shadow: 4px 4px 0 #000, 0 0 24px rgba(255,160,40,.45); line-height: 1; }
h1.small { font-size: 40px; }
.sub { font-size: 18px; color: var(--paper); margin: 10px 0 30px; text-shadow: 2px 2px 0 #000; }
.blink { animation: blink 1.2s infinite; font-size: 22px; text-shadow: 2px 2px 0 #000; }
@keyframes blink { 50% { opacity: .25 } }
.ver { position: absolute; bottom: calc(10px + var(--safe-b)); font-size: 12px; color: #9a8a7a; margin: 0; }
#loadbar { width: 220px; height: 10px; margin: 0 auto; border: 2px solid var(--gold); border-radius: 6px; overflow: hidden; }
#loadbar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
.panel { width: min(92vw, 360px); background: var(--paper) url(../assets/fx/panel_beigeLight.png) center / 100% 100%; color: var(--ink); border-radius: 14px; padding: 22px 20px; text-align: center; box-shadow: 0 6px 0 #000, 0 0 0 3px #3a2c24;
  max-height: 88vh; overflow-y: auto; touch-action: pan-y; }
.panel.text { text-align: left; font-size: 15px; line-height: 1.35; }
.panel.text p { margin: 8px 0; }
.panel h2 { margin: 0 0 14px; font-size: 32px; font-weight: normal; text-align: center; }
.panel h2.dead { color: #8b1010; }
.welcome { margin: 0; font-size: 18px; }
.btn { display: block; width: 100%; min-height: 54px; margin: 10px 0; border: 0; border-radius: 10px; font: 22px alagard, monospace; color: #fff; cursor: pointer;
  background: linear-gradient(#6e4b31, #4a3120 55%, #3b2618); border: 2px solid #24160e;
  box-shadow: inset 0 2px 0 rgba(255,214,150,.28), inset 0 -3px 0 rgba(0,0,0,.25), 0 4px 0 #120c09; text-shadow: 2px 2px 0 #1a0f08; }
.btn small { display: block; font-size: 13px; color: var(--gold); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,214,150,.2), 0 1px 0 #120c09; background: linear-gradient(#5e3f29, #3f2a1b); }
.btn.revive { background: linear-gradient(#3f8a3a, #2a6427 55%, #1f4d1c); border-color: #10280e; }
.btn.revive:active { background: linear-gradient(#347530, #1f4d1c); }
.btn.revive small { color: #d8ffb0; }
.langs { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.lang { font: 14px alagard, monospace; color: var(--ink); background: transparent; border: 2px solid #6b5443; border-radius: 8px; padding: 6px 10px; min-height: 36px; cursor: pointer; }
.lang.on { background: #4a3120; color: #fff; border-color: #24160e; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid #6b5443; box-shadow: none; min-height: 46px; font-size: 18px; }
.btn.small { width: auto; min-height: 44px; font-size: 16px; padding: 0 12px; margin: 0; }
.btn:disabled { opacity: .45; }
.best { font-size: 14px; margin: 8px 0 0; color: #5a4535; }
.web-extras { margin-top: 8px; }
.about-link { display: inline-block; margin-top: 8px; color: #5a4535; font-size: 14px; text-underline-offset: 3px; }
.about-link:hover, .about-link:focus-visible { color: #231a14; }
.pg .web-extras { display: none !important; }
.stats { font-size: 17px; line-height: 1.5; }
.toggles { display: flex; justify-content: center; gap: 12px; margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.toggles input { width: 18px; height: 18px; vertical-align: middle; accent-color: #6b4a2e; }
.shop { background: rgba(255,255,255,.35); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.shop-title { margin: 0 0 6px; font-size: 18px; }
.shop-item { display: flex; align-items: center; gap: 10px; text-align: left; }
.shop-item div { flex: 1; display: flex; flex-direction: column; }
.shop-item small { font-size: 12px; color: #5a4535; }
.shop-money { margin: 6px 0 0; font-size: 14px; }
#rotate { position: fixed; inset: 0; z-index: 50; background: #140c10; display: none; align-items: center; justify-content: center; font-size: 22px; text-align: center; padding: 30px; }

@media (orientation: landscape) and (pointer: coarse) and (max-height: 520px) { html:not(.pg) #rotate { display: flex; } }
