/* Alliance Wars - portrait map HUD, city sheets, attack panel, login (lane A). */
#map { position: fixed; inset: 0; display: block; image-rendering: pixelated; touch-action: none; }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; max-width: 560px; margin: 0 auto; }
#hud button, #hud .res { pointer-events: auto; }
#toasts { top: calc(68px + var(--safe-t)); }
body.panel-open #toasts { top: auto; bottom: calc(24px + var(--safe-b, 0px)); flex-direction: column-reverse; }
.sheet-open #hud .h-bottom, .sheet-open #hud .h-col { display: none; }

/* round HUD buttons */
.hb { position: relative; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(#34425f, #1f2840); border: 2px solid #0b0f18; box-shadow: inset 0 -3px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.12), 0 2px 4px rgba(0,0,0,.4); }
.hb.round { border-radius: 50%; width: 50px; height: 50px; }
.hb .ic.lg { width: 28px; height: 28px; }
.hb-l { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 700 12px/16px var(--pix); background: #0d1220; border: 1.5px solid #3a4867; border-radius: 8px; padding: 0 5px; }
.hb .cnt { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; color: #fff; background: #c8372b; border: 2px solid #fff; font: 800 11px/16px var(--txt); }
.hb.ready { background: linear-gradient(#ffd75f, #e09a1f); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }

/* top: one compact row = portrait | resources | settings */
.h-top { position: absolute; top: var(--safe-t); left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 5px; background: linear-gradient(#18213a, #0f1626); border: 1.5px solid #3a4867; border-top: 0; border-left: 0; border-right: 0; border-radius: 0 0 12px 12px; box-shadow: 0 3px 8px rgba(0,0,0,.4); } /* slim bar hugging portrait, resources, settings; flush under the phone's status bar */
.lord-mini { position: static; flex: none; display: flex; align-items: center; }
.lord-mini .avatar { border-width: 3px; }
.lord-mini .av-lvl { bottom: -4px; right: -6px; min-width: 18px; height: 18px; font-size: 11px; line-height: 14px; }
.lord-mini .avatar { width: 50px !important; height: 50px !important; border-width: 2.5px; }
.h-top .res { height: 38px; }
.h-top > .hb.sm { width: 40px !important; height: 40px !important; margin: 0 !important; } .h-top > .hb.sm .ic.lg { width: 32px !important; height: 32px !important; }
.lord-mini .xpb { position: absolute; left: 12px; right: 12px; bottom: 1px; height: 3px; border-radius: 2px; background: rgba(0,0,0,.6); overflow: hidden; } /* XP: a thin line along the bar's bottom edge */
.lord-mini .xpb > i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#9fd6ff, #2f7fe0); }
.lord-mini .xpb small { display: none; }
.lord-mini .dot { top: -4px; right: 4px; }
.res-row { flex: 1; display: flex; gap: 4px; min-width: 0; margin-top: 4px; }
.h-top > .hb.sm { margin-top: 2px; }
.res { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 3px; height: 40px; padding: 0 6px 0 3px; border-radius: 20px; background: rgba(0,0,0,.45); border: 1.5px solid #3a4867; font: 800 13px var(--txt); }
.res b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res.sapph b { color: var(--sapph); }
.res .plus { margin-left: auto; width: 18px; height: 18px; flex: none; border-radius: 6px; display: grid; place-items: center; background: linear-gradient(#2f9c45, #1f6e31); color: #fff; font: 800 15px/1 var(--txt); margin-right: -3px; }
.hb.sm { width: 38px; height: 38px; border-radius: 11px; } .hb.sm .ic.lg { width: 24px; height: 24px; }

/* league trophy: tinted by league */
.hb.trophy { width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 50% 35%, #a8703a, #5a3a20); }
.hb.trophy .ic.lg { width: 36px; height: 36px; }
.hb.trophy.lg-silver { background: radial-gradient(circle at 50% 35%, #c9d2de, #6b7688); }
.hb.trophy.lg-gold { background: radial-gradient(circle at 50% 35%, #ffd75f, #b07a14); }
.hb.trophy.lg-platinum { background: radial-gradient(circle at 50% 35%, #9fe8e0, #3a8a84); }
.hb.trophy.lg-diamond { background: radial-gradient(circle at 50% 35%, #9fd6ff, #2f6fd0); }
.hb.trophy.lg-legend { background: radial-gradient(circle at 50% 35%, #ff9e9e, #9a2a4a); }

/* side columns */
.h-col { position: absolute; top: calc(68px + var(--safe-t)); display: flex; flex-direction: column; gap: 16px; align-items: center; }
.h-col.left { left: 8px; } .h-col.right { right: 8px; }
.h-col .hb { width: 46px; height: 46px; }
.big-chest { position: relative; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(#5a3a20, #3a2412); border: 2px solid #0b0f18; box-shadow: inset 0 2px 0 rgba(255,255,255,.15), 0 3px 6px rgba(0,0,0,.45); }
.big-chest .ic.xl { width: 42px; height: 42px; }
.big-chest span { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 700 12px/18px var(--pix); background: #0d1220; border: 1.5px solid var(--gold2); border-radius: 9px; padding: 0 6px; color: var(--gold); }
.big-chest.ready { animation: pulse 1.2s infinite; background: linear-gradient(#ffd75f, #c98f1c); }
.big-chest.ready span { background: #23803a; color: #fff; border-color: #fff; }
.offer { position: relative; width: 52px; padding: 4px 0; border-radius: 50%/40%; background: radial-gradient(#ff8a7a, #c0392b); border: 2px solid #fff; display: flex; flex-direction: column; align-items: center; font: 700 12px/1.05 var(--pix); color: #fff; text-shadow: 0 1px 0 #000; animation: pulse 2s infinite; }

/* incoming attack */
#hAlert { pointer-events: auto; position: absolute; top: calc(68px + var(--safe-t)); left: 70px; right: 84px; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: linear-gradient(#e0574d, #9c2a21); border: 2px solid #fff; box-shadow: 0 0 0 3px rgba(224,87,77,.4), var(--shadow); animation: pop .2s, blink 1s infinite; cursor: pointer; }
#hAlert span { display: flex; flex-direction: column; } #hAlert b { font: 700 15px var(--pix); } #hAlert small { font-size: 12px; }
@keyframes blink { 50% { box-shadow: 0 0 0 7px rgba(224,87,77,.15), var(--shadow); } }

/* bottom: chat preview + bar */
.h-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 8px calc(8px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; }
.chat-prev { pointer-events: auto; align-self: stretch; height: 40px; border-radius: 10px; background: rgba(10,14,24,.78); border: 1.5px solid #3a4867; padding: 0 10px; text-align: left; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-prev span { display: block; overflow: hidden; text-overflow: ellipsis; }
.hb.quest { align-self: flex-start; width: 58px; height: 58px; border-radius: 16px; background: linear-gradient(#a0703f, #5a3a20); border-color: #2a1a0c; margin-bottom: 10px; }
.hb.quest .ic.lg { width: 40px; height: 40px; }
.chat-prev { display: flex; align-items: center; gap: 6px; }
.bbar { display: flex; justify-content: space-between; gap: 6px; padding: 8px 8px 12px; border-radius: 18px; background: linear-gradient(#2b3752f2, #161d2cf2); border: 2px solid #0b0f18; box-shadow: var(--shadow); }
.bbar .hb { flex: 1; height: 50px; max-width: 74px; }

/* select-target banner */
#pickBar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(68px + var(--safe-t)); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 14px; background: linear-gradient(#ffd75f, #e09a1f); color: #3b2a1a; border: 2px solid #3b2a1a; box-shadow: var(--shadow); white-space: nowrap; animation: pop .15s; }
#pickBar span { display: flex; align-items: center; gap: 6px; font: 700 16px var(--pix); }

/* bottom sheet (city / army / attack) */
#citySheet { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; padding: 8px 14px calc(14px + var(--safe-b)); background: linear-gradient(#222c41, #161d2c); border: 3px solid #0b0f18; border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,.5); animation: up .18s ease-out; touch-action: pan-y; }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.cs-grab { width: 44px; height: 5px; border-radius: 3px; background: #3a4867; margin: 0 auto 8px; }
.cs-x { position: absolute; top: 6px; right: 8px; width: 40px; height: 40px; border-radius: 10px; background: var(--card2); font-size: 16px; }
.cs-head { display: flex; align-items: center; gap: 10px; padding-right: 40px; }
.cs-ban { position: relative; flex: none; width: 46px; display: grid; place-items: center; }
.neutral-ban { width: 42px; height: 52px; display: grid; place-items: center; background: #4a4f5e; border-radius: 6px 6px 50% 50% / 6px 6px 18px 18px; border: 2px solid #1b1424; }
.lvl-shield { position: absolute; bottom: -6px; right: -6px; min-width: 26px; height: 24px; border-radius: 6px 6px 12px 12px; background: linear-gradient(#ffd75f, #e09a1f); color: #3b2a1a; border: 2px solid #3b2a1a; font: 700 13px/20px var(--pix); text-align: center; padding: 0 3px; }
.cs-title { flex: 1; min-width: 0; }
.cs-title h3 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-title .cap { font-size: 12px; color: var(--gold); vertical-align: middle; }
.cs-sub { font-size: 13px; color: var(--ink2); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cs-sub i { color: var(--sapph); font-style: normal; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; border: 1px solid #000; }
.cs-troops { display: flex; flex-direction: column; align-items: center; padding: 4px 10px; border-radius: 12px; background: rgba(0,0,0,.35); }
.cs-troops b { font: 700 18px var(--pix); } .cs-troops small { font-size: 12px; color: var(--ink2); }
.cs-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0 8px; }
.cs-stats span { display: flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.28); font-size: 13px; color: var(--ink2); }
.cs-stats b { color: var(--ink); }
.up-row { display: flex; gap: 8px; }
.up-row .up1 { flex: 1.6; } .up-row .btn.blue { flex: 1; flex-direction: column; gap: 0; line-height: 1.05; }
.up-row .btn.blue small { font-size: 12px; }
.hexrow { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.hexb { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.hexb .hx { width: 64px; height: 58px; display: grid; place-items: center; background: linear-gradient(#4a5a80, #2b3752); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.hexb.red .hx { background: linear-gradient(#ff7a6e, #b8392f); }
.hexb b { font: 700 14px var(--pix); } .hexb small { font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 2px; }
.hexb:disabled { opacity: .45; }
.cs-more { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
#citySheet .cs-more .btn, #citySheet .ra-row .btn { flex: 1 1 0; max-width: 150px; min-height: 40px; }
#citySheet .ra-row { flex-wrap: nowrap; }
.cs-warn { margin: 12px 0 0; padding: 8px; border-radius: 10px; background: rgba(224,87,77,.2); color: #ffd6d1; text-align: center; }

/* attack panel */
.atk-vs { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-right: 36px; }
.atk-vs .side { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }
.atk-vs .side b { font: 700 15px var(--pix); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atk-vs .side small { font-size: 12px; color: var(--ink2); display: flex; align-items: center; gap: 3px; }
.atk-vs .vs .ic.xl { width: 40px; height: 40px; }
.avatar.neutral { border-color: #9a9aa0; }
.atk-from { margin: 12px 0 8px; font-size: 13px; color: var(--ink2); }
.atk-from-l { display: block; margin: 0 2px 5px; font-weight: 800; }
.src-pick { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px 6px; scrollbar-width: thin; }
.src-c { flex: 0 0 104px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 44px; padding: 6px 6px 7px;
  border-radius: 12px; background: linear-gradient(#26314a, #1b2335); border: 2px solid var(--line); color: var(--ink); font: inherit; text-align: center; cursor: pointer; }
.src-c.on { border-color: var(--gold); background: linear-gradient(#3a3a2c, #262a2c); box-shadow: 0 0 0 2px rgba(245,198,60,.25), inset 0 0 12px rgba(245,198,60,.15); }
.src-c:focus-visible { outline: 3px solid var(--sapph); outline-offset: 1px; }
.src-art { width: 64px; height: 50px; display: flex; align-items: flex-end; justify-content: center; }
.src-art img { max-width: 64px; max-height: 50px; image-rendering: pixelated; }
.src-art img:not([src]) { visibility: hidden; }
.src-n { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 800; }
.src-m { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink2); }
.src-m i { font-style: normal; color: var(--gold); margin-right: 3px; }
.src-d { font-size: 10.5px; color: var(--mute); white-space: nowrap; }
.atk-n { display: flex; gap: 8px; align-items: center; }
.atk-n input { text-align: center; font: 700 22px var(--pix); padding: 5px; }
.atk-n .btn { flex: none; width: 46px; font-size: 22px; }
.atk-n input { min-width: 0; }
.atk-range { -webkit-appearance: none; appearance: none; width: 100%; height: 42px; background: none; border: 0; padding: 0; margin: 4px 0; }
.atk-range::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #5fd36b, #f5c63c, #e0574d); border: 2px solid #0b0f18; }
.atk-range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -11px; border-radius: 50%; background: #f3ecd9; border: 3px solid #3b2a1a; }
.atk-range::-moz-range-track { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #5fd36b, #f5c63c, #e0574d); }
.atk-range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #f3ecd9; border: 3px solid #3b2a1a; }
.atk-q button { min-height: 40px; }
.atk-info { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 10px 2px; font-size: 13px; flex-wrap: wrap; }
.atk-info span { display: flex; align-items: center; gap: 4px; }
.atk-go { min-height: 52px; font-size: 18px; }

/* level up */
.md.levelup { background: radial-gradient(circle at 50% 30%, #3a4a6b, #161d2c); border-color: var(--gold2); }
.lu { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0; }
.lu-lvl { font: 700 20px var(--pix); } .lu-lvl b { color: var(--gold); font-size: 30px; }

/* login */
#login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 30%, #2f4b7a, #121826 70%); }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; padding: 26px 20px; border-radius: 22px; background: rgba(18,24,38,.88); border: 3px solid #0b0f18; box-shadow: var(--shadow), inset 0 3px 0 rgba(255,255,255,.06); }
.login-crest { display: flex; gap: 6px; } .login-crest .ic.xl { width: 56px; height: 56px; }
.login-title { font: 700 44px/0.95 var(--pix); color: var(--ink); text-shadow: 0 4px 0 #0b0f18; letter-spacing: 1px; }
.login-title span { color: var(--gold); font-size: 54px; }
.login-sub { margin: 0; color: var(--ink2); }
.login-box input { text-align: center; font-size: 17px; }
.login-box .btn { min-height: 52px; font-size: 20px; }

/* ---- polish: floating HD icons on the map instead of dark boxes ---- */
.h-col .hb, .hb.quest, .h-top > .hb.sm { background: none; border: 0; box-shadow: none; width: 54px; height: 54px; }
.h-col .hb .ic.lg, .hb.quest .ic.lg { width: 46px; height: 46px; filter: drop-shadow(0 3px 2px rgba(0,0,0,.6)) drop-shadow(0 0 1px rgba(0,0,0,.9)); }
.h-top > .hb.sm .ic.lg { width: 30px; height: 30px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.6)); }
.h-col .hb-l, .hb.quest .hb-l { bottom: -8px; background: rgba(13,18,32,.88); border-color: #c9a24a; color: #ffe7a8; }
.hb.ready { background: none; animation: pulse 1.4s infinite; }
.hb.ready .ic.lg { filter: drop-shadow(0 0 6px #ffd75f) drop-shadow(0 3px 2px rgba(0,0,0,.6)); }
.hb.trophy, .hb.trophy.lg-silver, .hb.trophy.lg-gold, .hb.trophy.lg-platinum, .hb.trophy.lg-diamond, .hb.trophy.lg-legend { background: none; }
.big-chest { background: none; border: 0; box-shadow: none; width: 64px; height: 64px; }
.big-chest .ic.xl { width: 60px; height: 60px; filter: drop-shadow(0 3px 2px rgba(0,0,0,.6)); }
.big-chest.ready { background: none; }
.big-chest.ready .ic.xl { filter: drop-shadow(0 0 8px #ffd75f) drop-shadow(0 3px 2px rgba(0,0,0,.6)); }
.offer { background: none; border: 0; width: 60px; text-shadow: 0 1px 2px #000, 0 0 2px #000; }
.offer .ic.lg { width: 46px; height: 46px; filter: drop-shadow(0 0 6px rgba(95,180,255,.8)); }
.bbar .hb .ic.lg { width: 34px; height: 34px; }
.bbar .hb { background: linear-gradient(#3a4a6b, #222c41); }

/* ---- premium pass: city sheet, attack panel, level-up ---- */
#citySheet { background: linear-gradient(#26314a, #161d2c 70%); box-shadow: 0 -8px 24px rgba(0,0,0,.5), inset 0 2px 0 rgba(233,199,106,.45); }
.cs-title h3 { color: #ffe7a8; text-shadow: 0 2px 0 #0b0f18; }
.cs-stats span { background: linear-gradient(175deg, #283450, #1c2437); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.cs-stats .ic { width: 22px; height: 22px; }
.cs-troops { background: linear-gradient(175deg, #283450, #1c2437); box-shadow: inset 0 0 0 1px rgba(233,199,106,.25); }
.cs-troops .ic { width: 26px; height: 26px; }
.hexb .hx { width: 68px; height: 62px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.3); background: linear-gradient(#56689a, #2b3752); }
.hexb .hx .ic.lg { width: 40px; height: 40px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.5)); }
.atk-vs .avatar { border-width: 3px; }
.atk-info .ic { width: 22px; height: 22px; }
.md.levelup { box-shadow: var(--shadow), inset 0 0 0 2px rgba(233,199,106,.5), 0 0 40px rgba(245,198,60,.25); }
.md.levelup h3 { font-size: 28px; color: var(--gold); }
/* login */
#login { background: radial-gradient(circle at 50% 28%, rgba(47,75,122,.85), rgba(18,24,38,.96) 70%), url(../assets/tex_forest.png) center / 160px; }
.login-box { background: linear-gradient(175deg, rgba(36,48,73,.95), rgba(18,24,38,.95)); box-shadow: var(--shadow), inset 0 0 0 2px rgba(233,199,106,.45), inset 0 3px 0 rgba(255,255,255,.08); }
.login-crest { gap: 2px; margin-top: -4px; } .login-crest .ic.xl { width: 64px; height: 64px; filter: drop-shadow(0 4px 2px rgba(0,0,0,.6)); }
.login-crest .ic.xl:nth-child(2) { width: 80px; height: 80px; margin-top: -10px; }
.login-title span { text-shadow: 0 4px 0 #5a3a0c, 0 0 24px rgba(245,198,60,.35); }
#loginMsg:empty { display: none; }
.atk-vs .vs .ic.xl { width: 48px; height: 48px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }

/* parity lane: bookmark star on city sheets, XP hint on the attack panel, marches list */
.cs-bm { align-self: flex-start; width: 40px; height: 40px; margin-left: 6px; border-radius: 12px; display: grid; place-items: center; background: rgba(0,0,0,.35); border: 1.5px solid #3a4867; opacity: .55; filter: grayscale(1); }
.cs-bm.on { opacity: 1; filter: none; border-color: #e9c76a; background: rgba(233,199,106,.18); }
.atk-xp b { font-weight: 700; color: #9fe3a8; } .atk-xp.low b { color: #f0b35a; }
#hMarch.danger { background: linear-gradient(#7a2a2a, #4a1616); animation: mrPulse 1.2s ease-in-out infinite; }
@keyframes mrPulse { 50% { box-shadow: 0 0 0 3px rgba(255,90,90,.45); } }
.mr-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin-top: 8px; }
.mr-row { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 10px; border-radius: 12px; background: #1c2437; border: 1.5px solid #34425f; color: inherit; text-align: left; }
.mr-row.foe { border-color: #a33; background: #2a1a1f; }
.mr-mid { flex: 1; display: flex; flex-direction: column; min-width: 0; } .mr-mid small { color: var(--ink2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-n, .mr-t { display: flex; align-items: center; gap: 3px; font: 700 13px var(--pix); white-space: nowrap; }

/* ---- small phones: narrow top bar, tighter side columns on short screens ---- */
.h-top > .hb.sm { width: 44px; height: 44px; }
@media (max-width: 380px) {
  .h-top { gap: 4px; }
  .res { gap: 2px; padding: 0 5px 0 2px; font-size: 12.5px; }
  .res .ic { width: 18px; height: 18px; }
  .res .plus { width: 16px; height: 16px; font-size: 13px; }
  .h-top > .hb.sm { width: 40px; height: 40px; }
  .h-top > .hb.sm .ic.lg { width: 26px; height: 26px; }
}
@media (max-height: 720px) {
  .h-col { gap: 11px; top: calc(72px + var(--safe-t)); }
  .h-col .hb { width: 48px; height: 48px; } .h-col .hb .ic.lg { width: 40px; height: 40px; }
  .big-chest { width: 56px; height: 56px; } .big-chest .ic.xl { width: 50px; height: 50px; }
  .offer .ic.lg { width: 38px; height: 38px; }
  .hb.quest { width: 50px; height: 50px; margin-bottom: 8px; } .hb.quest .ic.lg { width: 40px; height: 40px; }
  .bbar { padding: 6px 8px 10px; } .bbar .hb { height: 46px; }
}
@media (max-width: 330px) {
  .res .plus { display: none; }
  .res { padding: 0 4px 0 2px; font-size: 12px; }
}
@media (max-height: 560px) {
  .h-col { gap: 7px; top: calc(64px + var(--safe-t)); }
  .h-col .hb { width: 42px; height: 42px; } .h-col .hb .ic.lg { width: 34px; height: 34px; }
  .h-col .hb-l { bottom: -6px; }
  .big-chest { width: 48px; height: 48px; } .big-chest .ic.xl { width: 42px; height: 42px; }
  .offer { width: 48px; } .offer .ic.lg { width: 32px; height: 32px; }
  .hb.quest { width: 44px; height: 44px; margin-bottom: 6px; } .hb.quest .ic.lg { width: 36px; height: 36px; }
  .bbar { padding: 5px 6px 8px; } .bbar .hb { height: 42px; } .bbar .hb .ic.lg { width: 28px; height: 28px; }
}
/* the same when the HUD measures itself too crowded (browser zoom, big fonts, many left buttons) */
#hud.tight .h-col { gap: 7px; }
#hud.tight .big-chest span { bottom: -6px; } #hud.tight .offer { margin-top: 3px; }
#hud.tight .h-col .hb { width: 42px; height: 42px; } #hud.tight .h-col .hb .ic.lg { width: 34px; height: 34px; }
#hud.tight .h-col .hb-l { bottom: -6px; }
#hud.tight .big-chest { width: 48px; height: 48px; } #hud.tight .big-chest .ic.xl { width: 42px; height: 42px; }
#hud.tight .offer { width: 48px; } #hud.tight .offer .ic.lg { width: 32px; height: 32px; }
#hud.tight .hb.quest { width: 44px; height: 44px; margin-bottom: 6px; } #hud.tight .hb.quest .ic.lg { width: 36px; height: 36px; }
#hud.tight .bbar { padding: 5px 6px 8px; } #hud.tight .bbar .hb { height: 42px; } #hud.tight .bbar .hb .ic.lg { width: 28px; height: 28px; }
@media (max-height: 560px) { .big-chest span { bottom: -6px; } .offer { margin-top: 2px; } }

/* ---- next goal hint (beside the quest book), first-win banner, while-you-were-away ---- */
.q-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.q-row .hb.quest { flex: none; }
.next-goal { pointer-events: auto; flex: 0 1 auto; min-width: 0; max-width: min(300px, calc(100% - 136px)); margin-bottom: 10px; display: flex; align-items: stretch; border-radius: 14px; background: rgba(10,14,24,.88); border: 2px solid #c9a24a; box-shadow: 0 3px 8px rgba(0,0,0,.45); }
.next-goal.ready { border-color: #ffd34d; background: linear-gradient(rgba(58,44,12,.95), rgba(28,22,8,.95)); }
.ng-main { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 5px 4px 5px 8px; text-align: left; }
.ng-main .ic { width: 28px; height: 28px; }
.ng-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ng-txt b { font: 700 14px/1.15 var(--pix); color: #ffe7a8; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ng-txt small { font-size: 12px; color: #d7d1c2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-bar { display: block; height: 5px; border-radius: 3px; background: rgba(0,0,0,.5); overflow: hidden; }
.ng-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #ffe27a, #e9a521); }
.next-goal.ready .ng-txt b { color: #ffd34d; }
.next-goal.ready { animation: pulse 1.6s infinite; }
.ng-x { flex: none; width: 40px; min-height: 40px; color: #b9b3a3; font-size: 15px; border-left: 1px solid rgba(233,199,106,.25); }
@media (max-height: 560px) { .next-goal { margin-bottom: 6px; } .ng-main { min-height: 44px; } }
.sheet-open #hud .next-goal { display: none; }

#celebrate { position: fixed; z-index: 95; left: 50%; top: calc(72px + var(--safe-t)); transform: translateX(-50%); width: min(calc(100vw - 24px), 380px); pointer-events: none; }
.cel-card { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(160deg, #4a3a12, #22190a); border: 3px solid #ffd34d; box-shadow: 0 0 0 3px rgba(0,0,0,.4), 0 0 28px rgba(255,211,77,.45), var(--shadow); }
.cel-card > div { position: relative; display: flex; flex-direction: column; gap: 3px; }
.cel-card b { font: 700 20px/1.1 var(--pix); color: #ffd34d; text-shadow: 0 2px 0 #000; }
.cel-card small { font-size: 13px; color: #f3ecd9; line-height: 1.3; }
.cel-card .ic.xl { position: relative; width: 56px; height: 56px; filter: drop-shadow(0 0 8px rgba(255,211,77,.8)); }
.cel-rays { position: absolute; left: -40px; top: 50%; width: 160px; height: 160px; margin-top: -80px; background: repeating-conic-gradient(rgba(255,211,77,.22) 0 12deg, transparent 12deg 30deg); border-radius: 50%; animation: celSpin 6s linear infinite; }
#celebrate.in .cel-card { animation: celIn .45s cubic-bezier(.2,1.6,.4,1); }
#celebrate.out { opacity: 0; transition: opacity .4s; }
@keyframes celIn { from { transform: scale(.5) translateY(-20px); opacity: 0; } }
@keyframes celSpin { to { transform: rotate(360deg); } }

.md.away .md-body > p { margin-bottom: 10px; }
.aw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.aw-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 12px; background: rgba(0,0,0,.28); border-left: 4px solid #3a4867; font-size: 14px; }
.aw-row b { color: #ffe7a8; font-family: var(--pix); font-size: 16px; }
.aw-row.good { border-left-color: var(--green); } .aw-row.bad { border-left-color: var(--red); background: rgba(224,87,77,.14); }
/* last resort (very large zoom): smaller side buttons without their captions; the buttons keep their accessible names */
#hud.tighter .h-col { gap: 5px; }
#hud.tighter .h-col .hb { width: 40px; height: 40px; } #hud.tighter .h-col .hb .ic.lg { width: 32px; height: 32px; }
#hud.tighter .h-col.left .hb-l { display: none; }
#hud.tighter .h-col.right { gap: 8px; }
#hud.narrow .res .plus, #hud.narrow .ng-main > .ic, #hud.narrow .ng-pre { display: none; }
#hud.narrow .res { padding: 0 4px 0 2px; font-size: 12px; gap: 2px; } #hud.narrow .res .ic { width: 16px; height: 16px; }

#hud.narrow .ng-txt b { font-size: 13px; }
/* back-home button (homearrow.js): round, at the map edge toward the capital */
#homeArrow { position: fixed; left: 0; top: 0; z-index: 9; width: 46px; height: 46px; padding: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; background: radial-gradient(circle at 50% 35%, #34425f, #161d2c); border: 2px solid #ffd75f; box-shadow: 0 3px 10px rgba(0,0,0,.55); color: #fff; font: 800 12px/12px 'Nunito', system-ui, sans-serif; cursor: pointer; touch-action: manipulation; transition: transform .12s ease-out; }
#homeArrow[hidden] { display: none; }
#homeArrow svg { width: 22px; height: 22px; margin-top: 1px; stroke: #0b0f18; stroke-width: 1.2; paint-order: stroke; }
#homeArrow b { font: 800 12px/12px 'Nunito', system-ui, sans-serif; text-shadow: 0 1px 1px #000; }
#homeArrow .ha-dir { position: absolute; inset: -2px; pointer-events: none; }
#homeArrow .ha-dir::after { content: ''; position: absolute; right: -11px; top: 50%; margin-top: -7px; border-left: 10px solid #ffd75f; border-top: 7px solid transparent; border-bottom: 7px solid transparent; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
#homeArrow:active { filter: brightness(1.2); }
@media (prefers-reduced-motion: reduce) { #homeArrow { transition: none; } }
/* first launch drops straight into a guest lord: the login box is only a loading card, and the sign-in form shows
   when Settings > Log in to another account reloaded with aw.switch */
#login:not(.switching) #nameIn, #login:not(.switching) #playBtn, #login:not(.switching) #haveAcc { display: none; }
#login.switching #nameIn, #login.switching #playBtn { display: none; }
