/* Sherwood Outlaw — desktop-first (web) layout. Stage: hero left, monsters right, hand below. */
:root {
  --green: #2D7D32; --green-d: #1B6520; --lime: #6CFF00; --gold: #F2B233;
  --cream: #FFF0C9; --ink: #1A1A1A; --red: #E53835; --brown: #A6692B; --blue: #4FA3E0; --purple: #B98CFF;
  --font-h: "Fredoka", "Segoe UI", system-ui, sans-serif; --font-b: "Nunito", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #0c2410; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font-b); color: var(--cream); user-select: none; -webkit-user-select: none; }
button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

#app {
  position: relative; height: 100vh; width: 100%; max-width: 1280px; margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  padding: 10px 24px 12px;
  background: linear-gradient(180deg, #1d5a24 0%, #174a1d 45%, #113716 100%);
}
#app.act2 { background: linear-gradient(180deg, #3b3a52 0%, #2a2a3d 45%, #1c1c2a 100%); }
#app.act3 { background: linear-gradient(180deg, #4a2a2a 0%, #351c1c 45%, #221010 100%); }

/* ---------- HUD ---------- */
#hud { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 2px 0 8px; }
.hpwrap { flex: 0 0 300px; }
#hpbar { position: relative; height: 28px; border-radius: 14px; background: rgba(0, 0, 0, .4); border: 2px solid var(--ink); overflow: hidden; }
#hpfill { position: absolute; inset: 0; width: 100%; background: linear-gradient(90deg, #e53835, #ff6b5e); transition: width .25s; }
#hptext { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 15px var(--font-b); color: #fff; text-shadow: 0 1px 0 #000; }
.hudrow { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.hudpill { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 2px solid rgba(0, 0, 0, .35); font: 800 14px var(--font-b); letter-spacing: .04em; white-space: nowrap; }
.hudpill.gold { color: var(--gold); }
.btnpill { cursor: pointer; }
.btnpill:hover { background: rgba(0, 0, 0, .45); }
.relics { flex: 1 1 auto; display: flex; gap: 5px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.relics::-webkit-scrollbar { display: none; }
.relic { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; }
.relic img { width: 100%; height: 100%; display: block; }
.ric img { width: 64px; height: 64px; display: block; }
.node img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.relic:hover { transform: scale(1.12); }
.roundbtn { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--ink); background: rgba(0, 0, 0, .3); box-shadow: 0 2px 0 var(--ink); cursor: pointer; font-size: 18px; }
.roundbtn.off { opacity: .55; }

/* ---------- screens ---------- */
#screens { flex: 1 1 auto; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; overflow-y: auto; overflow-x: hidden; padding: 8px 4px; }
.screen h2 { margin: 10px 0 2px; font: 700 40px var(--font-h); letter-spacing: .04em; color: var(--gold); text-shadow: 0 3px 0 var(--ink); }
.sub { margin: 4px 0 14px; font: 700 17px var(--font-b); color: rgba(255, 240, 201, .8); text-align: center; max-width: 560px; }
.lbl { margin: 10px 0 6px; font-size: 13px; font-weight: 800; letter-spacing: .14em; color: #c9d8b0; }
.fine { margin: 8px 0 0; font-size: 12px; color: rgba(255, 240, 201, .6); text-align: center; max-width: 460px; }
.hint { margin-top: auto; font-size: 13px; color: rgba(255, 240, 201, .55); }
.btn { display: block; width: 320px; margin: 12px auto 0; padding: 16px; border-radius: 16px; border: 2px solid var(--ink); background: var(--gold); color: var(--ink); font: 700 22px var(--font-h); letter-spacing: .06em; cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.alt { background: var(--green); color: var(--cream); font-size: 18px; padding: 13px; }
.btn:disabled { opacity: .5; }
.ghost { display: inline-block; margin: 10px auto 0; padding: 9px 16px; border-radius: 10px; border: 2px solid rgba(255, 240, 201, .35); background: transparent; color: var(--cream); font: 800 14px var(--font-b); cursor: pointer; }
.ghost:hover { background: rgba(0, 0, 0, .2); }
.homelink { display: block; margin-top: 6px; padding: 6px; color: rgba(255, 240, 201, .7); font: 800 13px var(--font-b); text-decoration: none; }

/* menu: delivered key art fills the screen, logo in the sky, buttons bottom-right over a dark panel */
#app.menu { padding: 0; }
#menu { padding: 0; background: url(art/bg/title_keyart.jpg) center / cover no-repeat; align-items: flex-end; justify-content: flex-end; }
#menu::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .15) 0%, rgba(0, 0, 0, 0) 35%, rgba(0, 0, 0, 0) 60%, rgba(8, 28, 12, .75) 100%); pointer-events: none; }
.menucard { position: relative; margin: 0 40px 28px auto; text-align: center; width: 380px; padding: 18px 16px 12px; border-radius: 20px; background: rgba(8, 28, 12, .72); border: 2px solid rgba(242, 178, 51, .5); backdrop-filter: blur(4px); }
.titlelogo { position: absolute; left: 50%; top: 26px; transform: translateX(-50%); width: min(620px, 50vw); height: auto; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .35)); }
#menu .sub { margin: 0 0 6px; }
#menu .btn { width: 100%; margin-top: 8px; }
#menu .homelink { margin-top: 4px; }

/* map */
.maptitle { font: 700 26px var(--font-h); letter-spacing: .1em; color: var(--gold); margin: 2px 0 4px; text-shadow: 0 2px 0 var(--ink); }
#mapWrap { position: relative; width: min(720px, 100%); flex: 1 1 auto; min-height: 0; }
#mapSvg { position: absolute; inset: 0; width: 100%; height: 100%; }
#mapSvg line { stroke: rgba(255, 240, 201, .3); stroke-width: 3; stroke-dasharray: 6 6; }
#mapSvg line.done { stroke: var(--gold); stroke-dasharray: none; opacity: .7; }
#mapNodes { position: absolute; inset: 0; }
.node { position: absolute; transform: translate(-50%, -50%); width: 60px; height: 60px; padding: 0; border-radius: 50%; border: 0; background: none; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(0, 0, 0, .5); cursor: default; }
.node.boss { width: 84px; height: 84px; }
.node.past { opacity: .4; }
.node.here { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242, 178, 51, .35), 0 3px 0 var(--ink); }
.node.next { border-color: var(--lime); cursor: pointer; animation: pulse 1.2s ease-in-out infinite; }
.node.next:hover { transform: translate(-50%, -50%) scale(1.12); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(108, 255, 0, .55), 0 3px 0 var(--ink); } 50% { box-shadow: 0 0 0 12px rgba(108, 255, 0, 0), 0 3px 0 var(--ink); } }

/* ---------- combat: one stage, hero left, monsters right ---------- */
#combat { padding: 0; justify-content: flex-start; overflow: hidden; }
#arena { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; position: relative; padding: 48px 40px 26px 60px; }
#arena::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; background: radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, .38), transparent 70%); pointer-events: none; }
#player { position: relative; flex: 0 0 300px; display: flex; flex-direction: column; align-items: center; z-index: 2; }
#enemies { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-end; justify-content: space-evenly; gap: 10px; z-index: 1; padding-right: 20px; }
.sprite { position: relative; display: flex; flex-direction: column; align-items: center; }
.sprite .shadow { position: absolute; left: 50%; bottom: -8px; width: 70%; height: 18px; border-radius: 50%; background: rgba(0, 0, 0, .4); transform: translateX(-50%); z-index: -1; }
.fxlayer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
#hero { display: block; width: 300px; height: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); animation: breathe 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
#combat { background-position: center bottom; background-size: cover; background-repeat: no-repeat; }
#combat.bg1 { background-image: url(art/bg/act1_forest.png); }
#combat.bg2 { background-image: url(art/bg/act2_town.png); }
#combat.bg3 { background-image: url(art/bg/act3_castle.png); }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.025) translateY(-1px); } }
#heroWrap.lunge { animation: lungeR .36s cubic-bezier(.2, .8, .3, 1); }
@keyframes lungeR { 0% { transform: translateX(0); } 35% { transform: translateX(120px) scale(1.06); } 100% { transform: translateX(0); } }
#heroWrap.cast { animation: cast .28s; }
@keyframes cast { 40% { transform: translateY(-14px) scale(1.05); } }
#heroWrap.hurt { animation: hurtL .34s; }
@keyframes hurtL { 20% { transform: translateX(-16px); filter: brightness(1.5) sepia(1) hue-rotate(-50deg) saturate(3); } 50% { transform: translateX(8px); } 80% { transform: translateX(-4px); filter: none; } }
#heroWrap.guard { animation: guard .3s; }
@keyframes guard { 40% { transform: scale(.94) translateY(6px); } }
.hpbar.hero { max-width: 200px; height: 20px; margin-top: 10px; }
.hpbar.hero span { font-size: 12px; }
#pstats { display: flex; align-items: center; gap: 6px; margin-top: 4px; min-height: 22px; }

.enemy { position: relative; display: flex; flex-direction: column; align-items: center; flex: 0 1 auto; max-width: 220px; min-width: 120px; cursor: default; }
.enemy.target .sprite { cursor: pointer; }
.enemy.target .mon { animation: wobble .9s ease-in-out infinite; }
.enemy.target .sprite::after { content: '👆'; position: absolute; left: 50%; top: -30px; transform: translateX(-50%); font-size: 26px; animation: bounce .6s ease-in-out infinite alternate; }
.enemy.target:hover .mon { filter: drop-shadow(0 0 10px var(--lime)) drop-shadow(0 4px 0 rgba(0, 0, 0, .35)); }
@keyframes bounce { from { transform: translate(-50%, 0); } to { transform: translate(-50%, -8px); } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg) scale(1.06); } 50% { transform: rotate(4deg) scale(1.06); } }
/* monster sprites: 400/480/640 canvases, feet 40px above the canvas bottom, bottom-aligned on the stage */
.enemy .mon { display: block; width: auto; height: 250px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .35)); animation: idle 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.enemy.elite .mon { height: 300px; }
.enemy.boss .mon { height: 390px; }
#enemies.n3 .enemy .mon { height: 210px; } #enemies.n3 .enemy.elite .mon { height: 250px; } #enemies.n3 .enemy.boss .mon { height: 330px; }
#enemies.n4 .enemy .mon { height: 170px; } #enemies.n4 .enemy.boss .mon { height: 280px; } #enemies.n4 .enemy { min-width: 96px; }
.enemy.dead { display: none; }
.enemy.dying .sprite { animation: dieOut .42s forwards; }
@keyframes dieOut { 0% { transform: scale(1); opacity: 1; } 60% { transform: scale(1.15) rotate(8deg); filter: brightness(2); } 100% { transform: scale(.2) rotate(-30deg); opacity: 0; } }
.enemy.hit .mon { animation: hitshake .32s; }
@keyframes hitshake { 0% { filter: brightness(3) drop-shadow(0 0 8px #fff); transform: translateX(-12px); } 30% { transform: translateX(12px); } 60% { transform: translateX(-6px); } 100% { filter: none; transform: translateX(0); } }
.enemy.lunge .sprite { animation: lungeL .38s cubic-bezier(.2, .8, .3, 1); }
@keyframes lungeL { 0% { transform: translateX(0); } 35% { transform: translateX(-110px) scale(1.08); } 100% { transform: translateX(0); } }
.enemy.acting .intent { animation: pulse2 .5s 2; border-color: #fff; }
.enemy.guard .sprite { animation: guard .3s; }
.intent { position: absolute; top: -44px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 5px; padding: 3px 12px 3px 6px; border-radius: 999px; background: rgba(0, 0, 0, .6); border: 2px solid rgba(255, 255, 255, .25); font: 900 18px var(--font-b); white-space: nowrap; z-index: 3; cursor: help; }
.intent:empty { display: none; }
.intent img, .st img, .blk img { width: 26px; height: 26px; display: block; }
.st img { width: 20px; height: 20px; margin-right: 2px; } .blk img { width: 20px; height: 20px; margin-right: 3px; }
.intent.attack { border-color: var(--red); }
.intent.charge { border-color: var(--gold); background: rgba(120, 30, 30, .8); animation: pulse2 .8s infinite; }
@keyframes pulse2 { 50% { transform: translateX(-50%) scale(1.1); } }
.ename { font: 800 14px var(--font-b); text-align: center; line-height: 1.1; margin-top: 10px; max-width: 200px; }
.hpbar { position: relative; width: 100%; max-width: 170px; height: 18px; margin-top: 4px; border-radius: 9px; background: rgba(0, 0, 0, .5); border: 2px solid var(--ink); overflow: hidden; }
.hpbar i { position: absolute; inset: 0; background: #e53835; transition: width .2s; }
.hpbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 900 11px var(--font-b); color: #fff; text-shadow: 0 1px 0 #000; }
.blk { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; background: #4fa3e0; color: var(--ink); font: 900 13px var(--font-b); border: 2px solid var(--ink); }
.blk.pop { animation: pop .3s; }
@keyframes pop { 50% { transform: scale(1.35); } }
.status { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 4px; min-height: 18px; }
.st { display: inline-flex; align-items: center; gap: 1px; padding: 1px 7px; border-radius: 6px; font: 900 12px var(--font-b); background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .25); cursor: help; }
.st.fury { color: #ff8a65; } .st.bitten { color: var(--purple); } .st.shaken { color: var(--gold); } .st.scared { color: var(--blue); }
.say { position: absolute; left: 10px; right: 10px; top: 8px; text-align: center; font: 700 30px var(--font-h); color: var(--gold); text-shadow: 0 3px 0 var(--ink); pointer-events: none; z-index: 5; animation: sayin .3s; }
@keyframes sayin { from { transform: scale(.6); opacity: 0; } }

/* hit effects, appended into a sprite's .fxlayer */
.fx { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); pointer-events: none; z-index: 4; }
.fx.slash { width: 150px; height: 150px; animation: slashIn .3s forwards; }
.fx.slash svg { width: 100%; height: 100%; overflow: visible; }
.fx.slash line { stroke: #fff; stroke-width: 9; stroke-linecap: round; filter: drop-shadow(0 0 5px var(--gold)); }
@keyframes slashIn { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-30deg); opacity: 0; } 30% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(0deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2) rotate(10deg); } }
.fx.frames { animation: framesIn .12s; filter: drop-shadow(0 0 6px rgba(242, 178, 51, .8)); }
.fx.frames.out { animation: framesOut .28s forwards; }
@keyframes framesIn { from { transform: translate(-50%, -50%) scale(.5); opacity: 0; } }
@keyframes framesOut { to { transform: translate(-50%, -50%) scale(1.25); opacity: 0; } }
.hudpill img { width: 20px; height: 20px; margin-right: 4px; }
.fx.impact { width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, #fff, rgba(255, 220, 120, .8) 40%, transparent 70%); animation: impact .28s forwards; }
@keyframes impact { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; } }
.fx.shield { width: 140px; height: 140px; border-radius: 50%; border: 5px solid #4fa3e0; box-shadow: 0 0 18px #4fa3e0, inset 0 0 18px rgba(79, 163, 224, .6); display: flex; align-items: center; justify-content: center; font-size: 48px; animation: shieldIn .4s forwards; }
@keyframes shieldIn { 0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; } 40% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
.fx.text { font: 700 38px var(--font-h); white-space: nowrap; animation: fxtext .75s forwards; text-shadow: 0 3px 0 var(--ink), 0 0 10px rgba(0, 0, 0, .5); color: #fff; }
.fx.text.dmg { color: #ff6b5e; } .fx.text.blk { color: #4fa3e0; } .fx.text.heal { color: var(--lime); } .fx.text.small { font-size: 22px; color: var(--gold); }
@keyframes fxtext { 0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -150%) scale(1); } }
.fx.poof { font-size: 70px; animation: poof .5s forwards; }
@keyframes poof { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1.8); opacity: 0; } }
#app.quake { animation: quake .3s; }
@keyframes quake { 0% { transform: translate(4px, -4px); } 25% { transform: translate(-5px, 4px); } 50% { transform: translate(4px, 3px); } 75% { transform: translate(-3px, -3px); } 100% { transform: none; } }
#app.redflash::after { content: ''; position: absolute; inset: 0; background: rgba(229, 56, 53, .3); pointer-events: none; z-index: 90; animation: fadeout .3s forwards; }
@keyframes fadeout { to { opacity: 0; } }

/* preview strip + hand */
.preview { flex: 0 0 auto; width: calc(100% - 24px); margin: 0 12px 6px; padding: 8px 16px; border-radius: 12px; background: rgba(0, 0, 0, .45); border: 2px solid var(--gold); font: 700 16px var(--font-b); line-height: 1.3; }
.preview b { font-family: var(--font-h); font-size: 19px; color: var(--gold); margin-right: 8px; }
.preview small { display: block; color: rgba(255, 240, 201, .65); font-size: 13px; margin-top: 2px; }
#handwrap { flex: 0 0 auto; width: 100%; position: relative; height: 224px; }
#energy { position: absolute; left: 10px; bottom: 60px; z-index: 5; width: 84px; height: 84px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, var(--gold) 55%, #b9862a); border: 4px solid var(--ink); display: flex; align-items: baseline; justify-content: center; color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
#energy b { font: 700 40px/84px var(--font-h); } #energy small { font: 900 14px var(--font-b); }
#hand { position: absolute; left: 120px; right: 150px; bottom: 6px; height: 196px; display: flex; align-items: flex-end; justify-content: center; }
/* Card = delivered frame PNG (252×368). Regions measured on the frame, as fractions of height:
   name band 16–25%, art window 25.5–68.5%, text parchment 72.5–90%. Children size in em; .card font-size = height/10. */
.card { position: relative; flex: 0 0 auto; width: 126px; height: 184px; font-size: 18.4px; border-radius: .6em; color: var(--ink); cursor: pointer; transition: transform .15s, margin .15s, box-shadow .15s; background: url(art/cards/frame_common.png) center / 100% 100% no-repeat; }
.card.rU { background-image: url(art/cards/frame_uncommon.png); }
.card.rR { background-image: url(art/cards/frame_rare.png); }
.card.X { filter: grayscale(1) brightness(.85); }
.card .win { position: absolute; left: 12%; right: 12%; top: 25.5%; height: 43%; background: #efe3c3; border-radius: .2em; z-index: 0; }
.card.A .win { background: linear-gradient(180deg, #ffd9c2, #fff1e6); } .card.S .win { background: linear-gradient(180deg, #cfe9ff, #eef7ff); } .card.P .win { background: linear-gradient(180deg, #e6d6ff, #f6f0ff); }
.card .cost { position: absolute; top: -.1em; left: -.1em; width: 1.75em; height: 1.75em; border-radius: 50%; background: var(--gold); border: .1em solid var(--ink); display: flex; align-items: center; justify-content: center; font: 700 .95em var(--font-h); z-index: 3; box-shadow: 0 .1em 0 var(--ink); }
.card .badge { position: absolute; top: .15em; right: .2em; width: 1.5em; height: 1.5em; z-index: 3; }
.card .cname { position: absolute; left: 14%; right: 14%; top: 16%; height: 9.5%; font: 600 .68em/1 var(--font-h); text-align: center; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; z-index: 2; }
.card .cicon { position: absolute; left: 12%; right: 12%; top: 25.5%; height: 43%; display: flex; align-items: center; justify-content: center; font-size: 2.4em; line-height: 1; z-index: 1; overflow: hidden; border-radius: .2em; }
.card .cicon img.ico { width: 72%; height: 72%; object-fit: contain; }
.card .cicon img.illu { width: 100%; height: 100%; object-fit: cover; }
.card .ctext { position: absolute; left: 14%; right: 14%; top: 72.5%; height: 18%; font: 700 .58em/1.2 var(--font-b); text-align: center; color: #2c2c2c; display: flex; align-items: center; justify-content: center; z-index: 2; overflow: hidden; }
.card.up .cname { color: var(--green-d); }
.card.dim { opacity: .55; }
#hand .card:hover { transform: translateY(-26px) scale(1.06); z-index: 40; }
#hand .card.sel { transform: translateY(-40px) scale(1.1); z-index: 50; filter: drop-shadow(0 0 6px var(--lime)) drop-shadow(0 0 2px var(--lime)); }
#hand .card.deal { animation: deal .32s backwards; }
@keyframes deal { from { transform: translateY(160px) rotate(-8deg); opacity: 0; } }
#hand .card.played { animation: played .25s forwards; pointer-events: none; }
@keyframes played { to { transform: translateY(-120px) scale(.6); opacity: 0; } }
.endbtn { position: absolute; right: 10px; bottom: 60px; z-index: 5; width: 118px; height: 76px; border-radius: 20px; border: 3px solid var(--ink); background: var(--red); color: #fff; font: 700 20px/1.1 var(--font-h); letter-spacing: .06em; box-shadow: 0 4px 0 var(--ink); cursor: pointer; }
.endbtn:hover { filter: brightness(1.1); }
.endbtn:active { transform: translateY(3px); box-shadow: none; }
.endbtn.glow { animation: pulse 1.2s ease-in-out infinite; }
#piles { position: absolute; left: 10px; bottom: 8px; z-index: 5; display: flex; gap: 6px; }
.pile { padding: 6px 12px; border-radius: 10px; border: 2px solid rgba(0, 0, 0, .4); background: rgba(0, 0, 0, .3); color: var(--cream); font: 800 14px var(--font-b); cursor: pointer; }
.pile:hover { background: rgba(0, 0, 0, .5); }
#app.busy #hand, #app.busy .endbtn, #app.busy .enemy { pointer-events: none; }
#floats { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* reward / shop / event */
.cardrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; padding: 6px; }
.cardrow .card { width: 150px; height: 219px; font-size: 21.9px; }
.cardrow .card:hover { transform: translateY(-8px) scale(1.04); filter: drop-shadow(0 0 6px var(--lime)); }
.cardgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 8px 4px; overflow-y: auto; }
.cardgrid .card { width: 126px; height: 184px; }
.cardgrid .card.pickable { filter: drop-shadow(0 0 5px var(--lime)); }
.cardgrid .card.pickable:hover { transform: translateY(-6px) scale(1.05); }
.pricetag { position: absolute; bottom: 8px; right: 6px; padding: 2px 8px; border-radius: 999px; background: var(--gold); border: 2px solid var(--ink); font: 900 12px var(--font-b); z-index: 1; }
.card.sold { opacity: .35; pointer-events: none; }
.relicrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 8px; }
.relicbtn { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 190px; padding: 12px 10px; border-radius: 14px; border: 2px solid var(--gold); background: rgba(0, 0, 0, .3); color: var(--cream); cursor: pointer; text-align: center; }
.relicbtn:hover { background: rgba(0, 0, 0, .5); transform: translateY(-3px); }
.relicbtn .ric { font-size: 36px; } .relicbtn b { font: 600 16px var(--font-h); } .relicbtn small { font: 700 12.5px var(--font-b); color: rgba(255, 240, 201, .7); line-height: 1.25; }
.relicbtn.sold { opacity: .35; pointer-events: none; }
.relicgot { display: flex; align-items: center; gap: 14px; padding: 14px 20px; margin: 8px 0; border-radius: 16px; background: rgba(0, 0, 0, .3); border: 2px solid var(--gold); max-width: 460px; }
.relicgot .ric { font-size: 46px; } .relicgot b { display: block; font: 600 20px var(--font-h); color: var(--gold); } .relicgot small { font: 700 14px var(--font-b); color: rgba(255, 240, 201, .8); }
.choices { display: grid; gap: 12px; width: 480px; margin-top: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 18px; border-radius: 14px; border: 2px solid var(--ink); background: var(--green-d); color: var(--cream); text-align: left; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.choice:hover { filter: brightness(1.15); }
.choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.choice b { font: 600 20px var(--font-h); } .choice small { font: 700 13.5px var(--font-b); color: rgba(255, 240, 201, .7); }
.choice:disabled { opacity: .45; }
.choice.wide { width: 480px; margin-top: 8px; }
.final { margin: 0; font: 700 80px/1 var(--font-h); color: var(--gold); text-shadow: 0 5px 0 var(--ink); }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 28, 12, .86); z-index: 100; padding: 16px; }
.overlay .panel { position: relative; width: min(960px, 100%); max-height: 100%; padding: 18px 22px; border-radius: 20px; border: 3px solid var(--ink); background: #164a1c; color: var(--cream); display: flex; flex-direction: column; box-shadow: 0 6px 0 var(--ink); overflow: hidden; }
.overlay .panel h2 { margin: 0; font: 700 28px var(--font-h); color: var(--gold); letter-spacing: .06em; }
.lbhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.close { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink); background: rgba(0, 0, 0, .3); color: var(--cream); font: 900 18px var(--font-b); cursor: pointer; }
.close:hover { background: rgba(0, 0, 0, .5); }
.howbody { overflow-y: auto; font: 700 15.5px/1.5 var(--font-b); }
.howp { margin: 8px 0; }
.howbody h3 { margin: 14px 0 6px; font: 700 18px var(--font-h); color: var(--gold); letter-spacing: .08em; }
.howlist { display: grid; gap: 5px; grid-template-columns: 1fr 1fr; }
.howlist div { padding: 8px 10px; border-radius: 8px; background: rgba(0, 0, 0, .25); }
.howlist b { color: var(--gold); }
/* leaderboard, identity, names, tutorial */
.menurow { display: flex; gap: 8px; margin-top: 8px; } .menurow .btn { margin-top: 0; flex: 1 1 0; width: auto; font-size: 15px; padding: 11px 6px; }
.namerow { display: flex; gap: 8px; justify-content: center; margin: 8px auto 0; width: min(380px, 100%); }
.namerow input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--ink); background: #fff8e5; color: var(--ink); font: 800 16px var(--font-b); }
.btn.small { width: auto; margin: 0; padding: 10px 16px; font-size: 16px; }
.rankline { margin: 8px 0 0; font: 800 15px var(--font-b); color: var(--gold); text-align: center; min-height: 1.2em; }
.rankline.muted { color: rgba(255, 240, 201, .6); font-weight: 700; }
.row.acts { display: flex; gap: 8px; justify-content: center; }
.lblist { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; max-height: 50vh; }
.lblist li { display: grid; grid-template-columns: 44px 26px 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font: 800 15px var(--font-b); }
.lblist li:nth-child(odd) { background: rgba(0, 0, 0, .18); }
.lblist li.me { outline: 2px solid var(--lime); background: rgba(108, 255, 0, .12); }
.lblist .rk { color: #c9d8b0; text-align: right; } .lblist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .lblist .nm small { display: block; font-size: 11px; color: rgba(255, 240, 201, .55); font-weight: 700; }
.lblist .sc { font-variant-numeric: tabular-nums; color: var(--gold); } .lblist .sc small { margin-left: 6px; font-size: 11px; color: rgba(255, 240, 201, .6); }
.badge { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: #8a978d; }
.badge.t0 { visibility: hidden; } .badge.t1 { background: #c17a3f; } .badge.t2 { background: #cbd5d8; } .badge.t3 { background: #f2b233; } .badge.t4 { background: #b98cff; } .badge.t5 { background: #12e08a; }
.mebox { flex: 0 0 auto; background: rgba(0, 0, 0, .22); border: 2px solid rgba(0, 0, 0, .28); border-radius: 14px; padding: 10px 12px; margin: 8px 0; text-align: left; }
.melbl { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .14em; color: #c9d8b0; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--ink); background: var(--green-d); color: var(--cream); font: 700 14px var(--font-b); text-align: left; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.opt .ic { font-size: 20px; line-height: 1; margin-bottom: 5px; } .opt b { font-size: 14px; font-weight: 900; } .opt small { font-size: 11.5px; color: rgba(255, 240, 201, .65); }
.opt.primary { background: var(--gold); color: var(--ink); } .opt.primary small { color: rgba(26, 26, 26, .65); }
#meRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.meid { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 120px; } .metxt { display: flex; flex-direction: column; min-width: 0; }
.menm { font-weight: 900; font-size: 16px; } .metier { font-size: 11.5px; font-weight: 700; color: rgba(255, 240, 201, .6); }
.meacts { display: flex; gap: 6px; } .meacts .ghost { margin: 0; padding: 6px 10px; }
.tip { position: absolute; left: 50%; bottom: 250px; transform: translateX(-50%); z-index: 60; max-width: 520px; padding: 12px 18px; border-radius: 14px; background: rgba(8, 28, 12, .92); border: 2px solid var(--gold); color: var(--cream); font: 800 16px var(--font-b); text-align: center; box-shadow: 0 6px 0 var(--ink); animation: sayin .3s; pointer-events: none; }
.tip::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 16px; height: 16px; background: rgba(8, 28, 12, .92); border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: translateX(-50%) rotate(45deg); }
.pile.draw { background-image: url(art/cards/back_default.png); background-size: 22px 32px; background-repeat: no-repeat; background-position: 6px center; padding-left: 32px; }
#app.nft .pile.draw { background-image: url(art/cards/back_nft_gold.png); }
#rotate { display: none; }
.rot { font-size: 48px; margin: 0; }
