/* Rise of Legends — layar game 1280×720 yang diskalakan (gaya game web 2D anime). */
:root { --gold: #f2c14e; --wood: #5a3a20; --wood2: #3b2615; --panel: #2c4a63; --panel2: #23394d; --ink: #fff7e6; --line: #1b130d; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0d0a08; overflow: hidden; font-family: Nunito, system-ui, sans-serif; color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }
#game { position: absolute; width: 1280px; height: 720px; transform-origin: 0 0; overflow: hidden; background: #fff; }
#rotate { display: none; position: fixed; inset: 0; z-index: 99; background: #0d0a08; color: var(--ink); place-items: center; text-align: center; padding: 24px; font-weight: 800; }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: grid; } }

/* ---------- bar atas ---------- */
.hudtop { position: absolute; inset: 0 0 auto 0; height: 64px; display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; z-index: 30; pointer-events: none; }
.hudtop > * { pointer-events: auto; }
.me { display: flex; align-items: center; gap: 8px; background: linear-gradient(90deg, #3b2615ee, #3b261500); border: 0; padding: 4px 30px 4px 4px; border-radius: 40px; text-align: left; }
.me .face { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--gold); background: #23394d center 8% / 170% no-repeat; flex: none; }
.me b { display: block; font-size: 16px; text-shadow: 0 1px 2px #000; }
.me small { color: #fde68a; font-weight: 800; }
.money { display: flex; gap: 10px; }
.money span { background: linear-gradient(#5a3a20, #3b2615); border: 2px solid #8a5a2a; border-radius: 20px; padding: 4px 14px; font-weight: 900; font-size: 16px; box-shadow: 0 2px 0 #1b130d; }

/* ---------- desa ---------- */
.scene { position: absolute; inset: 0; }
#village { background: linear-gradient(#f5f1e8, #e9e2d3); }
.title { position: absolute; left: 0; right: 0; top: 70px; text-align: center; margin: 0; font: 400 56px/1 Bangers, cursive; letter-spacing: 2px; color: #3b2615; }
.sign { position: absolute; min-width: 260px; height: 74px; padding: 0 26px; font: 400 34px/1 Bangers, cursive; letter-spacing: 1px; color: #3b2615;
  background: linear-gradient(#fffaf0, #e9dcc4); border: 5px solid #5a3a20; border-radius: 10px; box-shadow: inset 0 0 0 3px #c9a66a, 0 6px 0 #3b2615, 0 10px 18px #0004; transition: transform .12s; }
.sign:hover { transform: translateY(-3px) scale(1.03); }
.sign:active { transform: translateY(2px); }
.heroline { position: absolute; left: 0; right: 0; bottom: 0; height: 230px; display: flex; justify-content: center; align-items: flex-end; gap: 10px; pointer-events: none; opacity: .9; }
.heroline img { height: 210px; filter: drop-shadow(0 6px 4px #0004); }

/* ---------- panel bergaya game (Padepokan, Kandang, dst.) ---------- */
.panelwrap { position: absolute; inset: 0; background: #0007; z-index: 40; display: grid; place-items: center; }
.frame { position: relative; width: 1120px; height: 620px; margin-top: 40px; background: linear-gradient(#6b4423, #4a2e17); border: 6px solid #2a1a0d; border-radius: 18px; box-shadow: inset 0 0 0 4px #9a6a3a, 0 20px 40px #000a; padding: 64px 22px 22px; }
.ftitle { position: absolute; left: 24px; top: 10px; font: 400 40px/1 Bangers, cursive; color: var(--gold); letter-spacing: 1px; text-shadow: 0 3px 0 #2a1a0d; }
.close { position: absolute; right: -14px; top: -14px; width: 54px; height: 54px; border-radius: 50%; border: 4px solid #fff; background: radial-gradient(#ff5a4a, #b3261e); font-size: 22px; font-weight: 900; box-shadow: 0 3px 0 #5a120c; }
.fbody { position: absolute; inset: 64px 22px 22px; display: flex; gap: 14px; }
.box { background: #2a1a0d99; border: 3px solid #2a1a0d; border-radius: 12px; padding: 10px; overflow: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tab { width: 64px; height: 50px; border-radius: 10px 10px 0 0; border: 3px solid #2a1a0d; font-size: 24px; background: #3b2615; }
.tab[aria-pressed="true"] { background: #f2c14e; }
.list { display: flex; flex-direction: column; gap: 6px; }
.lrow { display: flex; align-items: center; gap: 10px; background: #5a3a20; border: 3px solid #2a1a0d; border-radius: 10px; padding: 6px 10px; text-align: left; }
.lrow[aria-pressed="true"] { background: #2563eb; }
.lrow .ico { width: 46px; height: 46px; flex: none; }
.lrow b { flex: 1; font-size: 18px; }
.lrow .lv { background: #1b130d; border-radius: 6px; padding: 2px 8px; font-weight: 900; }
.lrow .price { min-width: 92px; text-align: right; font-weight: 900; }
.lrow .eq { color: #86efac; font-weight: 900; font-size: 13px; }
.ico { position: relative; display: grid; place-items: center; border-radius: 10px; border: 3px solid #1b130d; font-size: 24px; overflow: hidden; }
.ico img { width: 100%; height: 100%; object-fit: cover; }
.detail { width: 380px; flex: none; display: flex; flex-direction: column; gap: 8px; }
.detail .big { width: 120px; height: 120px; font-size: 64px; }
.detail h3 { margin: 0; font: 400 30px/1 Bangers, cursive; letter-spacing: .5px; color: var(--gold); }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-weight: 900; font-size: 17px; }
.btn { border: 3px solid #1b130d; border-radius: 14px; padding: 8px 18px; font-weight: 900; font-size: 18px; background: linear-gradient(#5ad06a, #1f8a3a); box-shadow: 0 4px 0 #0f4a1f; }
.btn.red { background: linear-gradient(#ff7a5a, #b3261e); box-shadow: 0 4px 0 #5a120c; }
.btn.gold { background: linear-gradient(#ffe38a, #e0a52a); color: #2a1a0d; box-shadow: 0 4px 0 #6b3a10; }
.btn:disabled { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.slots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.slot { width: 64px; height: 64px; font-size: 28px; background: #1b130d; }
.slot.lock { border-color: #a855f7; }
.cards { display: flex; gap: 12px; flex-wrap: wrap; align-content: flex-start; }
.hc { width: 190px; background: #23394d; border: 4px solid #1b130d; border-radius: 14px; padding: 8px; text-align: center; }
.hc[aria-pressed="true"] { border-color: var(--gold); background: #3a5a7a; }
.hc img { height: 230px; max-width: 100%; object-fit: contain; display: block; margin: 0 auto; }
.hc b { display: block; font-size: 18px; }
.hc small { color: #fde68a; font-weight: 800; }
.pet { width: 150px; height: 150px; font-size: 76px; background: #fdfaf3; color: #000; }
.fg { display: grid; grid-template-columns: repeat(3, 130px); grid-template-rows: repeat(3, 92px); gap: 8px; }
.fg .c { border: 3px dashed #c9a66a66; border-radius: 12px; display: grid; place-items: center; background: #0003; }
.fg .c.on { border-style: solid; border-color: var(--gold); background: #5a3a20; }
.fg select { width: 118px; background: #1b130d; color: var(--ink); border: 2px solid #c9a66a; border-radius: 8px; padding: 6px; font-weight: 800; }
.forms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fm { text-align: left; background: #5a3a20; border: 3px solid #1b130d; border-radius: 12px; padding: 8px 10px; }
.fm[aria-pressed="true"] { border-color: var(--gold); background: #7a5028; }
.fm:disabled { opacity: .45; cursor: not-allowed; }
.fm b { font-size: 18px; } .fm small { display: block; color: #fde68a; }
.gtable { width: 100%; border-collapse: collapse; font-size: 16px; }
.gtable td, .gtable th { border-bottom: 1px solid #c9a66a55; padding: 6px; text-align: left; }
.hint { color: #fde68a; font-size: 14px; margin: 4px 0; }

/* ---------- pertarungan ---------- */
#battle { background: #fff; }
.arena { position: absolute; inset: 0; background: #fff center / cover no-repeat; }
.arena::after { content: ""; position: absolute; left: 0; right: 0; top: 300px; height: 2px; background: #0000000d; }
.stageinfo { position: absolute; right: 14px; top: 70px; color: #3b2615; font-weight: 900; text-align: right; z-index: 6; }
.skillname { position: absolute; left: 0; right: 0; top: 0; height: 56px; background: #fff; border-bottom: 4px solid #111; display: grid; place-items: center; font-size: 30px; font-weight: 800; color: #111; z-index: 25; letter-spacing: .5px; }
.mainhud { position: absolute; left: 10px; top: 64px; width: 360px; background: linear-gradient(#5a3a20f2, #3b2615f2); border: 3px solid #1b130d; border-radius: 12px; padding: 8px 10px 8px 84px; z-index: 6; min-height: 84px; }
.mainhud .face { position: absolute; left: 8px; top: 8px; width: 68px; height: 68px; border-radius: 50%; border: 3px solid var(--gold); background: #23394d center 8% / 170% no-repeat; }
.mainhud b { font-size: 15px; }
.bar { position: relative; height: 16px; background: #1b130d; border-radius: 4px; margin-top: 4px; overflow: hidden; font-size: 11px; font-weight: 900; }
.bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ff7a6a, #c0392b); transition: width .3s; }
.bar.cd i { background: linear-gradient(#7ab8ff, #2563eb); }
.bar span { position: relative; padding-left: 6px; line-height: 16px; text-shadow: 0 1px 1px #000; }
.units { position: absolute; inset: 0; }
.unit { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; transition: left .32s ease-in-out, top .32s ease-in-out, filter .2s, opacity .5s; }
.unit .art { position: relative; display: flex; align-items: flex-end; justify-content: center; overflow: visible; }
.unit .art img { display: block; max-width: none; filter: drop-shadow(0 6px 3px #0003); }
.unit.enemy .art img { transform: scaleX(-1); }
.unit .emo { line-height: 1; filter: drop-shadow(0 6px 3px #0003); }
.unit .shadow { width: 60%; height: 12px; border-radius: 50%; background: #0002; margin-top: -8px; }
.unit .tag { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 900; color: #222; white-space: nowrap; margin-top: 2px; }
.unit .tag em { font-style: normal; background: #3b2615; color: #fde68a; border-radius: 4px; padding: 0 4px; }
.unit .hp { width: 104px; height: 6px; background: #0003; border: 1px solid #0005; border-radius: 3px; overflow: hidden; position: relative; }
.unit .hp i { position: absolute; inset: 0 auto 0 0; background: #e53935; transition: width .3s; }
.unit.ally .hp i { background: #e53935; }
.unit .hp s { position: absolute; inset: 0 auto 0 0; background: #60a5fa; opacity: .8; text-decoration: none; width: 0; }
.unit .sts { display: flex; gap: 2px; font-size: 13px; min-height: 16px; }
.unit.turn .art { filter: drop-shadow(0 0 10px #f2c14e) drop-shadow(0 0 4px #f2c14e); }
.unit.main .tag::before { content: "★"; color: #e0a52a; }
.unit.dead { opacity: .15; filter: grayscale(1); }
.unit.targetable { cursor: pointer; }
.unit.targetable .art { animation: bob .8s infinite; }
.unit.targetable::after { content: "▼"; position: absolute; top: -26px; color: #e11d48; font-size: 24px; animation: bob .8s infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.unit.hit .art { animation: hit .25s; }
@keyframes hit { 30% { transform: translateX(10px); filter: brightness(3); } 60% { transform: translateX(-6px); } }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.vfxc { position: absolute; inset: 0; width: 1280px; height: 720px; pointer-events: none; z-index: 19; }
.num { position: absolute; transform: translate(-50%, -50%); font: 400 40px/1 Bangers, cursive; color: #fff; -webkit-text-stroke: 2px #1b130d; letter-spacing: 1px; animation: num 1s forwards; white-space: nowrap; }
.num.crit { font-size: 56px; color: #fde047; }
.num.heal { color: #4ade80; }
.num.rx { font-size: 30px; color: #fde68a; background: #1b130dcc; -webkit-text-stroke: 0; padding: 2px 10px; border-radius: 10px; }
.num.small { font-size: 26px; }
@keyframes num { 0% { transform: translate(-50%, -30%) scale(.6); } 20% { transform: translate(-50%, -60%) scale(1.15); } 100% { transform: translate(-50%, -140%) scale(1); opacity: 0; } }
.proj { position: absolute; font-size: 44px; transform: translate(-50%, -50%); filter: drop-shadow(0 0 8px #fff) drop-shadow(0 0 4px #000a); }
.burst { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; border: 6px solid; animation: burst .45s forwards; }
@keyframes burst { from { width: 10px; height: 10px; opacity: 1; } to { width: 180px; height: 180px; opacity: 0; } }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translate(8px, -4px); } 40% { transform: translate(-8px, 4px); } 60% { transform: translate(6px, 2px); } 80% { transform: translate(-4px, -2px); } }
.cutin { position: absolute; inset: 120px 0 180px; z-index: 24; display: flex; align-items: center; background: linear-gradient(100deg, #1e1b4b 0, #312e81 40%, #f2c14e 41%, #f2c14e 43%, #1e1b4b 44%); overflow: hidden; animation: cutin 1.4s forwards; }
.cutin img { position: absolute; right: 8%; height: 230%; top: -20%; animation: cutimg 1.4s forwards; }
.cutin b { position: relative; margin-left: 6%; font: 400 64px/1 Bangers, cursive; color: var(--gold); letter-spacing: 2px; text-shadow: 0 4px 0 #7a2a10; }
@keyframes cutin { 0% { clip-path: inset(50% 0); } 12%, 85% { clip-path: inset(0 0); } 100% { clip-path: inset(50% 0); } }
@keyframes cutimg { from { transform: translateX(120px); } to { transform: translateX(0); } }

.skillbar { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 22; padding: 6px 8px 22px; background: #1b130dcc; border-radius: 14px; }
.sk { position: relative; width: 60px; height: 60px; border-radius: 12px; border: 4px solid #1b130d; font-size: 30px; padding: 0; box-shadow: 0 4px 0 #1b130d; }
.sk small { position: absolute; left: -4px; right: -4px; bottom: -19px; font-size: 10px; font-weight: 900; color: #fde68a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sk.ult { border-color: #7c3aed; box-shadow: 0 0 0 3px #f2c14e, 0 4px 0 #1b130d; }
.sk:disabled { filter: grayscale(1) brightness(.7); cursor: not-allowed; }
.sk .cdv { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; color: #fff; font: 400 38px/1 Bangers, cursive; border-radius: 8px; }
.sk[aria-pressed="true"] { transform: translateY(-6px); box-shadow: 0 0 0 4px #e11d48, 0 8px 0 #1b130d; }
.tip { position: absolute; z-index: 26; left: 50%; bottom: 182px; transform: translateX(-50%); width: 420px; background: #fff; color: #111; border: 3px solid #111; border-radius: 6px; padding: 8px 12px; font-size: 15px; }
.tip b { font-size: 17px; }
.turnbar { position: absolute; left: 160px; right: 330px; bottom: 18px; height: 40px; display: flex; align-items: center; z-index: 21; }
.turnbar .cloud { font-size: 30px; margin-right: -6px; z-index: 1; }
.track { position: relative; flex: 1; height: 22px; background: linear-gradient(#5b5bd6, #2a2aa0); border: 3px solid #1b130d; border-radius: 4px; }
.track .tk { position: absolute; top: 50%; width: 40px; height: 40px; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid #fff; background: #fff center 8% / 170% no-repeat; display: grid; place-items: center; font-size: 22px; transition: left .4s; }
.track .tk.enemy { border-color: #e11d48; }
.track .tk.ally { border-color: #22c55e; }
.turnbar .action { font: 400 30px/1 Bangers, cursive; color: #fff; -webkit-text-stroke: 1.5px #1b130d; margin-left: 6px; letter-spacing: 1px; }
.bmenu { position: absolute; right: 12px; bottom: 8px; display: flex; gap: 6px; z-index: 22; }
.bmenu button { width: 70px; height: 62px; border-radius: 50%; border: 3px solid #1b130d; background: radial-gradient(#5a5a5a, #2a2a2a); font-size: 22px; display: grid; place-items: center; line-height: 1; padding: 0; }
.bmenu button small { font-size: 11px; font-weight: 900; }
.bmenu button[aria-pressed="true"] { background: radial-gradient(#5ad06a, #1f8a3a); }
.result { position: absolute; inset: 0; z-index: 45; background: #0009; display: grid; place-items: center; }
.result .frame { width: 760px; height: auto; margin: 0; padding: 70px 24px 24px; }
.result table { width: 100%; border-collapse: collapse; font-size: 17px; }
.result td, .result th { padding: 6px; border-bottom: 1px solid #c9a66a55; text-align: right; }
.result td:first-child, .result th:first-child { text-align: left; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; } }
