/* Toy Front - snow sky, sand panels, olive headers, army green and medal gold buttons. */
:root {
  --sky: #dbe6f1; --sand: #f4efe2; --sand2: #e6dcc3; --olive: #5c6b3a; --olive2: #3f4b26; --khaki: #a89a6a;
  --green: #4caf50; --green2: #2e7d32; --gold: #ffc531; --gold2: #e79a12; --red: #e53935; --red2: #b71c1c;
  --ink: #2b3340; --muted: #6f7a66; --miss: #d84a3a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.ic { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
.ic.sm { width: 18px; height: 18px; }
.ic.face { width: 52px; height: 52px; border-radius: 50%; background: #fff; }
.ic.face.big { width: 72px; height: 72px; }
.ic.hero { width: 140px; height: 140px; }
.muted { color: var(--muted); }
.miss { color: var(--miss); }
#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 16px; font-weight: 700; font-size: 16px; color: #fff;
  background: linear-gradient(#66c466, var(--green2)); box-shadow: 0 4px 0 #1b5e20, 0 6px 10px rgba(0,0,0,.18); text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1b5e20; }
.btn.gold { background: linear-gradient(#ffd75a, var(--gold2)); box-shadow: 0 4px 0 #b06e06, 0 6px 10px rgba(0,0,0,.18); color: #5a3300; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn.soft { background: #fff; color: var(--olive2); box-shadow: 0 4px 0 #cfc5a8, 0 4px 8px rgba(0,0,0,.08); text-shadow: none; }
.btn.red { background: linear-gradient(#ff6a5a, var(--red2)); box-shadow: 0 4px 0 #7f1511; }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn.xl { padding: 16px 64px; font-size: 26px; border-radius: 22px; }
.btn:disabled { filter: grayscale(.7); opacity: .6; }
.round { width: 44px; height: 44px; border-radius: 50%; background: var(--sand); box-shadow: 0 3px 0 #cfc5a8, 0 4px 10px rgba(0,0,0,.2); display: grid; place-items: center; }
.round.x { font-size: 28px; line-height: 1; color: var(--olive2); font-weight: 700; }

/* ---- HUD ---- */
#top { position: fixed; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; align-items: center; gap: 8px; pointer-events: none; z-index: 5; }
#top > * { pointer-events: auto; }
#rankBox { display: flex; align-items: center; }
#rank { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fc86b, var(--olive2)); color: #fff; font-weight: 700; font-size: 20px; display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.25); z-index: 1; text-shadow: 0 1px 0 rgba(0,0,0,.3); }
#xpbar { position: relative; width: 70px; height: 20px; margin-left: -10px; background: rgba(40,50,30,.6); border-radius: 0 10px 10px 0; overflow: hidden; }
#xpfill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ffe27a, #f2b50a); }
#xptext { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.6); padding-left: 8px; }
.pills { display: flex; gap: 4px; margin-left: auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.pill { white-space: nowrap; display: flex; align-items: center; gap: 3px; height: 30px; padding: 0 7px 0 3px; border-radius: 15px; background: rgba(40,50,30,.62); color: #fff; font-weight: 600; font-size: 14px; }
.pill.gold { background: rgba(120,80,10,.7); }
.pill.full b { color: #ffb0a0; }
@media (max-width: 420px) { #top { gap: 4px; } .pills { gap: 3px; flex-wrap: nowrap; } .pill { font-size: 12px; padding: 0 5px 0 2px; height: 28px; gap: 2px; } .pill .ic { width: 20px; height: 20px; } .pill .plus { width: 15px; height: 15px; font-size: 12px; } #rank { width: 40px; height: 40px; font-size: 17px; } #xpbar { width: 54px; height: 18px; } #xptext { font-size: 10px; } }
.pill .ic { width: 24px; height: 24px; }
.pill .plus { width: 18px; height: 18px; border-radius: 50%; background: var(--green); display: grid; place-items: center; font-size: 15px; line-height: 1; }
#menuBtn { position: fixed; top: calc(62px + var(--safe-t)); right: calc(8px + var(--safe-r)); z-index: 5; flex-direction: column; gap: 3px; display: flex; align-items: center; justify-content: center; }
#menuBtn span { width: 18px; height: 3px; border-radius: 2px; background: var(--olive2); }
#menuDot { position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
#bottom { position: fixed; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); display: flex; gap: 8px; align-items: flex-end; z-index: 5; pointer-events: none; }
#bottom > * { pointer-events: auto; }
.spacer { flex: 1; pointer-events: none !important; }
.hbtn { position: relative; width: 72px; height: 72px; border-radius: 22px; background: var(--sand); box-shadow: 0 4px 0 #cfc5a8, 0 6px 14px rgba(0,0,0,.22); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--olive2); }
.hbtn .ic { width: 44px; height: 40px; }
.hbtn small { position: absolute; top: -8px; right: -6px; background: var(--olive2); color: #fff; border-radius: 10px; padding: 1px 6px; font-size: 11px; }
.hbtn small:empty { display: none; }
.hbtn.shop { background: linear-gradient(#ffd75a, var(--gold2)); color: #5a3300; box-shadow: 0 4px 0 #b06e06, 0 6px 14px rgba(0,0,0,.22); }
.hbtn.attack { background: linear-gradient(#ff7b62, var(--red2)); color: #fff; box-shadow: 0 4px 0 #7f1511, 0 6px 14px rgba(0,0,0,.22); width: 84px; height: 84px; border-radius: 26px; }
.hbtn.attack .ic { width: 50px; height: 46px; }
.hbtn.hot::after { content: '!'; position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 15px; border: 2px solid #fff; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---- toast, guide ---- */
#toast { position: fixed; left: 50%; top: calc(110px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; transition: .25s; z-index: 60; background: rgba(35,42,30,.9); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 500; font-size: 15px; max-width: 88vw; text-align: center; pointer-events: none; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#guide { position: fixed; left: 10px; right: 10px; bottom: calc(100px + var(--safe-b)); display: flex; gap: 10px; align-items: center; background: var(--sand); border-radius: 18px; padding: 10px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); z-index: 6; transform: translateY(20px); opacity: 0; transition: .3s; pointer-events: none; }
#guide.on { transform: none; opacity: 1; }
#guide p { margin: 0; font-weight: 500; font-size: 15px; }

/* ---- placement bar ---- */
#placebar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); z-index: 9; display: none; align-items: center; gap: 8px; background: var(--sand); padding: 10px; border-radius: 18px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
#placebar.on { display: flex; }
#placebar span { flex: 1; font-weight: 600; font-size: 15px; }
body:has(#placebar.on) #bottom { display: none; }

/* ---- sheet ---- */
#scrim { position: fixed; inset: 0; background: rgba(20,25,30,.4); opacity: 0; pointer-events: none; transition: .2s; z-index: 21; }
#scrim.on { opacity: 1; pointer-events: auto; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 80vh; z-index: 22; background: var(--sand); border-radius: 26px 26px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,.2); transform: translateY(105%); transition: transform .25s ease; display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
#sheet.open { transform: none; }
.sheethead { display: flex; align-items: center; padding: 12px 14px 6px 18px; background: linear-gradient(var(--olive), var(--olive2)); border-radius: 26px 26px 0 0; color: #fff; }
.sheethead h3 { flex: 1; margin: 0; font-size: 22px; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.sheethead .cap { font-size: 14px; opacity: .9; margin-left: 6px; font-weight: 500; }
#sheetBody { overflow-y: auto; padding: 12px 14px 18px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#sheetBody h4 { margin: 14px 0 6px; color: var(--olive2); }
#sheetBody p { margin: 6px 0; }
.row { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }
.center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tab { padding: 8px 14px; border-radius: 14px; background: var(--sand2); font-weight: 600; color: var(--olive2); white-space: nowrap; }
.tab.on { background: var(--olive2); color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.card { background: #fff; border-radius: 18px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 3px 0 #ddd3b8; position: relative; }
.card.dim { opacity: .55; }
.cardimg { position: relative; width: 86px; height: 76px; display: grid; place-items: center; }
.cardimg .ic { width: 86px; height: 76px; }
.card b { font-size: 14px; text-align: center; }
.card small { font-size: 11px; color: var(--muted); text-align: center; }
.card .have { position: absolute; top: 6px; left: 8px; }
.price { display: flex; align-items: center; gap: 4px; font-weight: 700; color: var(--olive2); font-size: 13px; flex-wrap: wrap; justify-content: center; }
.price span { display: inline-flex; align-items: center; gap: 1px; }
.lock { position: absolute; bottom: 0; right: 0; background: var(--olive2); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 8px; }
.needs { display: flex; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 13px; }
.needs span { display: inline-flex; align-items: center; gap: 2px; }
.stat { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; margin: 6px 0; }
.stat > div { flex: 1; display: flex; flex-direction: column; }
.stat small { color: var(--muted); }
.capbar { height: 14px; border-radius: 7px; background: var(--sand2); overflow: hidden; margin: 8px 0; }
.capbar i { display: block; height: 100%; background: linear-gradient(#8fe36b, var(--green2)); }
.menu { display: flex; flex-direction: column; gap: 8px; }
.mrow { text-align: left; background: #fff; border-radius: 14px; padding: 14px; font-weight: 600; font-size: 16px; box-shadow: 0 2px 0 #ddd3b8; }
.help p { line-height: 1.45; }
.about h2 { margin: 6px 0 0; color: var(--olive2); }
.madeby { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.madeby img { height: 30px; width: auto; }

/* building sheet */
.bhead { display: flex; gap: 12px; align-items: center; }
.bhead .ic { width: 96px; height: 96px; }
.bhead > div { flex: 1; }
.bhead h2 { margin: 0; font-size: 20px; color: var(--olive2); }
.lvlpill { display: inline-block; background: var(--olive2); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 700; margin-left: 6px; vertical-align: middle; }
.queue { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.qslot { position: relative; width: 60px; height: 60px; border-radius: 16px; background: #fff; display: grid; place-items: center; box-shadow: inset 0 0 0 2px #e8dfc4; }
.qslot.empty { background: rgba(255,255,255,.5); }
.qslot .ic { width: 42px; height: 42px; }
.qslot em { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 700; background: var(--olive2); color: #fff; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.qslot.run { box-shadow: inset 0 0 0 3px var(--gold); }
.units { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.unit { display: flex; gap: 10px; align-items: center; text-align: left; background: #fff; border-radius: 16px; padding: 8px 10px; box-shadow: 0 3px 0 #ddd3b8; }
.unit > .ic { width: 56px; height: 56px; }
.unit > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.unit small { color: var(--muted); font-size: 12px; }
.unit.dim { opacity: .5; }
.unit .pw { font-weight: 700; color: var(--green2); font-size: 13px; }

/* army grid */
.army { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.sq { position: relative; background: #fff; border-radius: 16px; padding: 8px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; box-shadow: 0 3px 0 #ddd3b8; }
.sq .ic { width: 50px; height: 50px; }
.sq b { font-size: 13px; }
.sq .pw { font-size: 12px; font-weight: 700; color: var(--green2); }
.sq .lv { position: absolute; top: 4px; left: 6px; background: var(--olive2); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 11px; font-weight: 700; }
.sq .gar { position: absolute; top: 4px; right: 6px; width: 18px; height: 18px; }
.sq.on { box-shadow: 0 0 0 3px var(--gold2); }
.sq.can { box-shadow: 0 0 0 3px var(--green); }
.sq.hurt { opacity: .6; }
.sq.hurt::after { content: attr(data-heal); position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.sq.pick { box-shadow: 0 0 0 3px var(--green2); background: #e6f5e6; }
.sqdet { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sqdet .ic { width: 64px; height: 64px; }
.sqdet > div { flex: 1; min-width: 120px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.pack { position: relative; background: #fff; border-radius: 18px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; box-shadow: 0 3px 0 #ddd3b8; }
.pack .ic { width: 52px; height: 52px; }
.pack .btn .ic { width: 18px; height: 18px; }
.pack em { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
.pack small { color: var(--muted); font-size: 12px; }
.mission { display: flex; gap: 10px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; margin: 6px 0; }
.mission > div { flex: 1; }
.mission .capbar { margin: 4px 0 0; height: 10px; }
.mission.done { box-shadow: 0 0 0 3px var(--green); }
.rlog { background: #fff; border-radius: 16px; padding: 10px; margin: 6px 0; display: flex; gap: 10px; align-items: center; }
.rlog b.w { color: var(--green2); } .rlog b.l { color: var(--red); }
.rlog > div { flex: 1; }

/* ---- rank up ---- */
#rankUp { position: fixed; inset: 0; z-index: 40; background: rgba(20,25,30,.5); display: none; place-items: center; }
#rankUp.on { display: grid; }
.rankcard { width: min(320px, 86vw); background: var(--sand); border-radius: 28px; padding: 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: popin .35s ease; }
.rankcard small { font-size: 18px; font-weight: 700; color: var(--olive2); text-transform: uppercase; letter-spacing: 1px; }
.burst { width: 110px; height: 110px; margin: 10px auto; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fc86b, var(--olive2)); display: grid; place-items: center; border: 5px solid #fff; box-shadow: 0 0 0 6px var(--gold), 0 6px 18px rgba(0,0,0,.25); }
.burst b { font-size: 48px; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
@keyframes popin { from { transform: scale(.7); opacity: 0; } }

/* ---- valley ---- */
#valley { position: fixed; inset: 0; z-index: 20; display: none; background: var(--sky); }
#valley.on { display: block; }
#vmap { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.vtop { position: absolute; top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; align-items: center; gap: 10px; }
.vtop h2 { flex: 1; margin: 0; font-size: 22px; color: #fff; text-shadow: 0 2px 0 var(--olive2), 0 4px 8px rgba(0,0,0,.3); -webkit-text-stroke: 1px var(--olive2); paint-order: stroke fill; }
.vpower { display: flex; align-items: center; gap: 4px; background: rgba(40,50,30,.65); color: #fff; border-radius: 15px; padding: 0 10px 0 4px; height: 32px; font-weight: 700; }
#campCard { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); background: var(--sand); border-radius: 22px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: none; }
#campCard.on { display: block; }
.cchead { display: flex; gap: 10px; align-items: center; }
.cchead .ic { width: 64px; height: 64px; }
.cchead > div { flex: 1; }
.cchead h3 { margin: 0; font-size: 18px; color: var(--olive2); }
.cchead small { color: var(--muted); }
.ccstars em { display: inline-block; width: 18px; height: 18px; margin-right: 2px; background: url(../assets/img/u_star.webp) center/contain no-repeat; filter: grayscale(1) opacity(.45); }
.ccstars em.on { filter: none; }
.vs { display: flex; gap: 8px; margin: 10px 0; }
.vs > div { flex: 1; background: #fff; border-radius: 14px; padding: 8px; text-align: center; }
.vs small { display: block; color: var(--muted); font-size: 12px; }
.vs b { font-size: 18px; }
.vs .mine b { color: var(--green2); } .vs .them b { color: var(--red); }
.scout { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.scout span { display: inline-flex; align-items: center; gap: 2px; background: #fff; border-radius: 10px; padding: 2px 6px; font-size: 12px; font-weight: 600; }
.scout .ic { width: 22px; height: 22px; }
.loot { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 14px; color: var(--olive2); flex-wrap: wrap; }
.loot span { display: inline-flex; align-items: center; gap: 2px; }

/* ---- battle ---- */
#battle { position: fixed; inset: 0; z-index: 30; display: none; background: #e9f0f7; }
#battle.on { display: block; }
#bfield { position: absolute; inset: 0; width: 100%; height: 100%; }
.btop { position: absolute; top: calc(8px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.bname { display: flex; align-items: baseline; gap: 10px; color: #fff; text-shadow: 0 2px 0 var(--olive2), 0 3px 8px rgba(0,0,0,.4); font-size: 18px; }
.bname small { font-weight: 600; font-size: 13px; margin-left: auto; }
.bprog { position: relative; height: 18px; border-radius: 9px; background: rgba(40,50,30,.6); overflow: visible; }
.bprog i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(#ff7b62, var(--red2)); width: 0; transition: width .25s; }
.bstars { position: absolute; inset: 0; display: flex; justify-content: space-between; padding: 0 50% 0 0; }
.bstars em { position: absolute; top: -6px; width: 28px; height: 28px; background: url(../assets/img/u_star.webp) center/contain no-repeat; filter: grayscale(1) opacity(.5); transform: translateX(-50%); }
.bstars em.on { filter: none; transform: translateX(-50%) scale(1.15); }
#bs1 { left: 35%; } #bs2 { left: 50%; } #bs3 { left: 100%; }
.bbot { position: absolute; bottom: calc(12px + var(--safe-b)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); display: flex; gap: 8px; align-items: center; }
#result { position: fixed; inset: 0; z-index: 35; background: rgba(20,25,30,.55); display: none; place-items: center; }
#result.on { display: grid; }
.rcard { width: min(360px, 90vw); background: var(--sand); border-radius: 28px; padding: 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: popin .35s ease; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rcard h2 { margin: 0; font-size: 30px; color: var(--olive2); }
.rcard h2.lost { color: var(--red); }
.rstars { display: flex; gap: 8px; }
.rstars em { width: 44px; height: 44px; background: url(../assets/img/u_star.webp) center/contain no-repeat; filter: grayscale(1) opacity(.4); }
.rstars em.on { filter: none; animation: popin .4s ease both; }
.rstars em:nth-child(2) { animation-delay: .15s; } .rstars em:nth-child(3) { animation-delay: .3s; }
.rcard .loot { justify-content: center; font-size: 16px; }
.rcard .loot .ic { width: 30px; height: 30px; }
.rcard p { margin: 0; }

/* ---- title ---- */
#title { position: fixed; inset: 0; z-index: 50; background: var(--sky); display: flex; flex-direction: column; align-items: center; transition: opacity .4s; }
#title.gone { opacity: 0; pointer-events: none; }
#title .splash { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tbox { position: relative; margin-top: calc(8vh + var(--safe-t)); text-align: center; }
.tbox h1 { margin: 0; font-size: clamp(52px, 17vw, 96px); line-height: .9; font-weight: 700; color: #fff; letter-spacing: 1px; text-shadow: 0 4px 0 var(--olive), 0 7px 0 var(--olive2), 0 12px 18px rgba(0,0,0,.35); -webkit-text-stroke: 2px var(--olive2); paint-order: stroke fill; }
.tag { margin: 12px 0 0; display: inline-block; background: rgba(255,255,255,.9); color: var(--olive2); font-weight: 600; padding: 6px 16px; border-radius: 16px; font-size: 14px; }
.tfoot { position: absolute; bottom: calc(28px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
#tstatus { margin: 0; color: #fff; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.5); min-height: 16px; }
#title .madeby { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); background: rgba(20,25,30,.4); padding: 6px 12px; border-radius: 14px; }

/* ---- landscape: side panel, compact HUD ---- */
@media (orientation: landscape) {
  #sheet { left: auto; top: 0; right: 0; bottom: 0; width: min(440px, 58vw); max-height: none; border-radius: 24px 0 0 24px; transform: translateX(105%); padding-bottom: 0; padding-right: var(--safe-r); }
  #sheet.open { transform: none; }
  .sheethead { border-radius: 24px 0 0 0; padding-top: calc(10px + var(--safe-t)); }
  #sheetBody { padding-bottom: calc(14px + var(--safe-b)); }
  #guide, #placebar { left: 50%; right: auto; width: min(520px, 70vw); transform: translateX(-50%); }
  #guide { transform: translate(-50%, 20px); } #guide.on { transform: translate(-50%, 0); }
  #campCard { left: auto; right: calc(10px + var(--safe-r)); width: min(400px, 48vw); bottom: calc(10px + var(--safe-b)); }
  .tbox { margin-top: calc(5vh + var(--safe-t)); } .tbox h1 { font-size: clamp(40px, 13vh, 84px); } .tbox h1 br { display: none; }
  .tfoot { bottom: calc(14px + var(--safe-b)); gap: 6px; } .btn.xl { padding: 12px 56px; font-size: 22px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .hbtn { width: 60px; height: 60px; border-radius: 18px; font-size: 12px; } .hbtn .ic { width: 36px; height: 32px; }
  .hbtn.attack { width: 70px; height: 70px; } #rank { width: 40px; height: 40px; font-size: 18px; }
  #menuBtn { top: calc(54px + var(--safe-t)); width: 40px; height: 40px; } #guide { bottom: calc(76px + var(--safe-b)); }
  .rankcard { padding: 12px; } .burst { width: 84px; height: 84px; margin: 6px auto; } .burst b { font-size: 38px; }
}
/* ---- tablets: the phone interface scaled up ---- */
@media (min-width: 1000px) and (min-height: 700px) {
  #placebar, #guide, #toast, .rankcard, .rcard, #campCard, .vtop, .btop, .bbot { zoom: 1.4; }
  #top { transform: scale(1.4); transform-origin: top left; width: calc((100vw - 16px - var(--safe-l) - var(--safe-r)) / 1.4); right: auto; }
  #bottom { transform: scale(1.4); transform-origin: bottom left; width: calc((100vw - 16px - var(--safe-l) - var(--safe-r)) / 1.4); right: auto; }
  #menuBtn { transform: scale(1.4); transform-origin: top right; }
  #sheet { zoom: 1.35; }
}
