/* evm.zone — mainnet. Black, flat, shard-cut UI over the live war map. */
:root {
  --bg: #000;
  --panel: rgba(8, 8, 8, .94);
  --card: #111;
  --card2: #171717;
  --line: #222;
  --line2: #333;
  --txt: #ECE9E1;
  --muted: #8d8a83;
  --dim: #5d5b56;
  --core: #FEC23E;
  --red: #ff5a4f;
  --green: #3ddc84;
  --cc: var(--core);
  --cf: #000;
  --display: Unbounded, 'Arial Black', system-ui, sans-serif;
  --ui: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --panel-w: 384px;
  --top-h: 76px;
  color-scheme: dark;
}
html[data-clan=robinhood] { --cc: #C8F542; --cf: #000; }
html[data-clan=ethereum] { --cc: #A396FF; --cf: #000; }
html[data-clan=base] { --cc: #2A63FE; --cf: #fff; }
html[data-clan=arc] { --cc: #FE7A2F; --cf: #000; }
html[data-clan=ink] { --cc: #F2469C; --cf: #000; }
[data-k=robinhood] { --c: #C8F542; --f: #000; }
[data-k=ethereum] { --c: #A396FF; --f: #000; }
[data-k=base] { --c: #2A63FE; --f: #fff; }
[data-k=arc] { --c: #FE7A2F; --f: #000; }
[data-k=ink] { --c: #F2469C; --f: #000; }
[data-k=none] { --c: #FEC23E; --f: #000; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; /* no double-tap zoom on the UI; the map has its own */ }
html, body { height: 100%; overscroll-behavior: none; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--txt); font: 500 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
a, button, input, label { touch-action: manipulation; }
a { color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
b { font-weight: 700; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; opacity: 0; transition: opacity .6s ease; }
#map.on { opacity: 1; }

/* ---------- compat ---------- */
.compat { display: none; position: fixed; z-index: 90; top: 0; left: 0; right: 0; padding: 10px 16px; background: var(--core); color: #000; font: 600 13px/1.4 var(--ui); text-align: center; }
.compat b { margin-right: 6px; }
.compat .c-om, .compat .c-st { display: none; }
.omini .compat, .stuck .compat { display: block; }
.omini .compat .c-om { display: inline; }
.stuck:not(.omini) .compat .c-st { display: inline; }

/* ---------- buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--core); color: #000; font: 800 13px/1 var(--display); letter-spacing: .01em; text-decoration: none; white-space: nowrap; transition: transform .12s, filter .15s, background .15s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: default; filter: none; transform: none; }
.btn.big { height: 54px; width: 100%; font-size: 15px; border-radius: 14px; }
.btn.sm { height: 34px; padding: 0 13px; font-size: 11.5px; border-radius: 10px; }
.btn.ghost { background: transparent; color: var(--txt); box-shadow: inset 0 0 0 1.5px var(--line2); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px #555; filter: none; }
.btn.clan { background: var(--cc); color: var(--cf); }
.btn .arr { width: 18px; height: 18px; }
.btn .cnt { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 6px; background: rgba(0,0,0,.18); font: 800 11px/1 var(--display); }
.btn.ghost .cnt { background: #222; }
.link { background: none; border: 0; padding: 4px 2px; color: var(--muted); font: 600 12.5px/1 var(--ui); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #444; }
.link:hover { color: var(--txt); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px; background: rgba(12,12,12,.88); border: 1px solid var(--line2); font: 600 13px/1 var(--ui); white-space: nowrap; text-decoration: none; color: var(--muted); }
.chip b { font: 800 13px/1 var(--display); color: var(--txt); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(61,220,132,.18); animation: pulse 1.6s ease-in-out infinite; }
.wbtn { color: var(--txt); font-weight: 700; }
.wbtn.on { border-color: var(--cc); }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }
.kicker { display: inline-flex; align-items: center; gap: 8px; font: 700 11px/1 var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.kicker i { width: 9px; height: 9px; background: var(--cc); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.fine { margin: 12px 0 0; color: var(--dim); font: 600 11.5px/1.4 var(--ui); }
.cpill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 7px; background: var(--c, #333); color: var(--f, #fff); font: 800 10px/1 var(--display); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.cpill svg { width: 11px; height: 11px; }
.cpill.neutral { background: #2a2a2a; color: var(--txt); }
.zn { display: inline-block; width: 10px; height: 10px; background: var(--core); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }

/* ---------- header ---------- */
.top { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; padding-top: max(16px, env(safe-area-inset-top)); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--txt); }
.mk { width: 36px; height: 36px; display: block; flex: none; }
.wm { font: 800 23px/1 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.wm i { display: inline-block; width: .3em; height: .3em; background: var(--core); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); margin: 0 .07em 0 .09em; }
.top-r { display: flex; gap: 8px; align-items: center; }
.clock { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(12,12,12,.88); border: 1px solid var(--line2); }
.ck { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; font: 600 12px/1 var(--ui); color: var(--muted); }
.ck svg { width: 14px; height: 14px; color: var(--red); }
.ck b { font: 800 12.5px/1 var(--display); color: var(--txt); font-variant-numeric: tabular-nums; min-width: 34px; }
.ck-war.hot { background: rgba(255,90,79,.14); }
.ck-war.hot b { color: var(--red); }
.ck-pay.hot { background: rgba(254,194,62,.14); }

/* ---------- panel ---------- */
.panel { position: fixed; z-index: 20; top: var(--top-h); left: 18px; width: var(--panel-w); max-height: calc(100% - var(--top-h) - 18px); overflow: auto; overscroll-behavior: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; scrollbar-width: thin; scrollbar-color: #333 transparent; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.grab { display: none; }
.hero h1 { margin: 14px 0 10px; font: 800 27px/1.12 var(--display); letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--core); }
.lead { margin: 0 0 16px; color: #bdb9b0; font-size: 14px; }
.lead b { color: var(--core); }
.ctable { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.crow { display: grid; grid-template-columns: 30px 1fr auto auto; align-items: center; gap: 10px; padding: 9px 10px 9px 9px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-align: left; transition: border-color .15s, background .15s; }
.crow:hover { border-color: var(--c); background: #151515; }
.crow .sig { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--c); color: var(--f); }
.crow .sig svg { width: 17px; height: 17px; }
.crow .cn { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.crow .cn b { font: 800 13px/1 var(--display); }
.crow .cn span { font: 600 11px/1 var(--ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow .cz { text-align: right; font: 600 11px/1.25 var(--ui); color: var(--muted); }
.crow .cz b { display: block; font: 800 14px/1.1 var(--display); color: var(--txt); }
.crow .cm { height: 30px; padding: 0 10px; border-radius: 9px; border: 0; background: var(--c); color: var(--f); font: 800 10.5px/1 var(--display); }
.crow .cm:disabled { background: #222; color: var(--dim); cursor: default; }
.hero-acts { display: flex; flex-direction: column; gap: 8px; }

/* enlisted */
.me-h { display: flex; align-items: center; gap: 12px; }
.me-sig { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--cc); color: var(--cf); flex: none; }
.me-sig svg { width: 24px; height: 24px; }
.me-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.me-t b { font: 800 16px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t span { font: 600 12px/1 var(--ui); color: var(--muted); }
.bal { display: flex; align-items: baseline; gap: 10px; margin: 18px 0 14px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.bal-l { font: 800 11px/1 var(--display); color: var(--core); letter-spacing: .04em; }
.bal > b { font: 800 26px/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bal-r { font: 600 12px/1 var(--ui); color: var(--muted); white-space: nowrap; }
.bal-r b { color: var(--green); font: 800 13px/1 var(--display); }
.bal.bump > b { animation: bump .6s ease; }
@keyframes bump { 30% { color: var(--core); transform: scale(1.04); } }
.army-sum { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 14px; }
.as { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px 8px; border-radius: 11px; background: var(--card); border: 1px solid var(--line); }
.as b { font: 800 16px/1 var(--display); }
.as span { font: 600 10px/1 var(--ui); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.as.z b { color: var(--cc); } .as.m b { color: #fff; } .as.s b { color: var(--red); } .as.h b { color: var(--dim); }
.me-acts { display: flex; gap: 6px; }
.me-acts .btn { flex: 1; padding: 0 10px; }
.hint { margin: 12px 0 0; color: var(--muted); font: 600 12.5px/1.4 var(--ui); }
.hint b { color: var(--txt); }

/* zone */
.z-h { display: flex; align-items: center; gap: 10px; }
.back { font-size: 20px; text-decoration: none; padding: 2px 6px 4px 0; }
.z-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.z-t b { font: 800 19px/1.1 var(--display); letter-spacing: -.01em; }
.z-t span { font: 600 12px/1 var(--ui); color: var(--muted); }
.z-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 16px 0 10px; }
.z-stats > div { display: flex; flex-direction: column; gap: 5px; padding: 11px 11px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.z-stats span { font: 700 10px/1 var(--ui); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.z-stats b { font: 800 18px/1 var(--display); font-variant-numeric: tabular-nums; }
.z-stats em { font: 600 11px/1.2 var(--ui); font-style: normal; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.z-sieges { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.zs { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 11px; background: rgba(255,90,79,.08); border: 1px solid rgba(255,90,79,.3); font: 600 12.5px/1.2 var(--ui); }
.zs b { font: 800 12px/1 var(--display); }
.zs .cpill { flex: none; }
.zs .t { margin-left: auto; color: var(--red); font: 800 11px/1 var(--display); font-variant-numeric: tabular-nums; }
.z-who { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.z-who:empty { display: none; }
.zw-r { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.zw-l { width: 100%; font: 700 10px/1 var(--ui); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.zw { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font: 600 12px/1 var(--ui); color: #bdb9b0; white-space: nowrap; }
.zw i { width: 9px; height: 9px; background: var(--c); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.zw b { color: var(--txt); font-weight: 700; }
.zw em { font-style: normal; color: var(--dim); font-size: 11px; }
.order { margin-top: 6px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.order.attack { border-color: rgba(255,90,79,.45); }
.order.reinforce { border-color: color-mix(in srgb, var(--cc) 55%, transparent); }
.o-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.o-h b { font: 800 14px/1 var(--display); }
.order.attack .o-h b { color: var(--red); }
.order.reinforce .o-h b { color: var(--cc); }
.o-h span { font: 600 11.5px/1.2 var(--ui); color: var(--muted); text-align: right; }
.o-pick { display: grid; grid-template-columns: 38px 1fr 38px 46px; align-items: center; gap: 8px; }
.step { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: #0b0b0b; font: 700 18px/1 var(--ui); }
.step:hover { border-color: #555; }
.o-n { font: 800 20px/1 var(--display); text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--cc); height: 28px; }
.o-q { display: flex; gap: 5px; margin: 10px 0 12px; flex-wrap: wrap; }
.o-q button { height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line2); background: #0b0b0b; font: 700 11.5px/1 var(--ui); color: var(--muted); }
.o-q button:hover { color: var(--txt); border-color: #555; }
.o-est { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 12px; font: 600 12px/1.3 var(--ui); color: var(--muted); }
.o-est b { color: var(--txt); font: 800 12.5px/1 var(--display); font-variant-numeric: tabular-nums; }
.o-est .odds { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.o-est .bar { flex: 1; height: 8px; border-radius: 4px; background: #262626; overflow: hidden; }
.o-est .bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width .25s; }
.o-est .bar.lo i { background: var(--red); } .o-est .bar.mid i { background: var(--core); }
.o-msg { min-height: 0; margin: 8px 0 0; font: 600 12.5px/1.35 var(--ui); color: var(--muted); }
.o-msg.err { color: var(--red); }
.z-acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.z-acts .btn { flex: 1; }
.z-note { margin: 4px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px dashed var(--line2); color: var(--muted); font: 600 12.5px/1.45 var(--ui); }
.z-note b { color: var(--txt); }

/* ---------- territory bar ---------- */
.war { position: fixed; z-index: 15; left: calc(var(--panel-w) + 48px); right: 340px; bottom: 22px; max-width: 760px; margin: 0 auto; pointer-events: none; }
.war-t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; font: 700 11px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.war-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.war-t em { font-style: normal; color: var(--txt); margin-left: 8px; letter-spacing: .08em; }
.war-t em i { font-style: normal; color: var(--hc, var(--core)); }
.war-t b { flex: none; white-space: nowrap; font: 800 11px/1 var(--display); color: var(--dim); letter-spacing: .04em; }
.war-bar { display: flex; gap: 4px; height: 26px; }
.seg { position: relative; display: flex; align-items: center; gap: 5px; padding: 0 8px; height: 100%; background: var(--c); color: var(--f); border-radius: 6px; transition: flex-grow 1.2s cubic-bezier(.3,.8,.3,1); min-width: 30px; overflow: hidden; font: 800 11px/1 var(--display); }
.seg svg { width: 12px; height: 12px; flex: none; }
.seg span { white-space: nowrap; }

/* ---------- feed ---------- */
.feed { position: fixed; z-index: 18; top: var(--top-h); right: 18px; width: 300px; max-height: min(52vh, 460px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 14px 8px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.feed-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.feed-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; text-align: left; }
.feed-h b { font: 800 12px/1 var(--display); letter-spacing: .02em; white-space: nowrap; }
.feed-last { display: none; flex: 1; min-width: 0; font: 600 12px/1.2 var(--ui); color: #bdb9b0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-last em { font-style: normal; color: var(--c, var(--core)); font-weight: 700; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-135deg) translate(-2px, -2px); flex: none; transition: transform .2s; }
.feed.min { max-height: none; padding-bottom: 6px; }
.feed.min .feed-h { margin-bottom: 0; }
.feed.min ol { display: none; }
.feed.min .feed-last { display: block; }
.feed.min .chev { transform: rotate(45deg) translate(-2px, -2px); }
html.feed-min .war { right: 80px; }
.feed ol { list-style: none; margin: 0; padding: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.feed li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: start; padding: 7px 2px; border-top: 1px solid #181818; font: 600 12px/1.35 var(--ui); color: #bdb9b0; animation: fin .4s ease; }
.feed li:first-child { border-top: 0; }
.feed li i { width: 11px; height: 11px; margin-top: 3px; background: var(--c); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.feed li b { color: var(--txt); }
.feed li em { font-style: normal; color: var(--c); font-weight: 700; }
.feed li time { color: var(--dim); font: 600 10.5px/1.6 var(--ui); white-space: nowrap; }
.feed li.z { cursor: pointer; }
.feed li.z:hover { color: var(--txt); }
@keyframes fin { from { opacity: 0; transform: translateY(-4px); } }

.zoomers { position: fixed; z-index: 16; right: 18px; bottom: 22px; display: flex; flex-direction: column; gap: 6px; }
.zoomers button { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(12,12,12,.9); font: 700 18px/1 var(--ui); display: grid; place-items: center; }
.zoomers button:hover { border-color: #555; }
.zoomers svg { width: 18px; height: 18px; }

/* ---------- modals ---------- */
.modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: min(520px, 100%); max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain; background: #0a0a0a; border: 1px solid var(--line2); border-radius: 22px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.7); animation: rise .25s cubic-bezier(.3,.8,.3,1); scrollbar-width: thin; scrollbar-color: #333 transparent; }
@keyframes rise { from { transform: translateY(14px); opacity: .4; } }
.sheet .kicker { margin-right: 44px; } /* clear of the × */
.sheet h2 { margin: 12px 0 8px; font: 800 24px/1.15 var(--display); letter-spacing: -.02em; }
.sheet .sub { margin: 0 0 18px; color: #bdb9b0; font-size: 14px; }
.x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line2); background: #111; font: 600 20px/1 var(--ui); color: var(--muted); }
.x:hover { color: var(--txt); border-color: #555; }
.msg { min-height: 18px; margin: 10px 0 0; font: 600 13px/1.4 var(--ui); color: var(--muted); }
.msg.err { color: var(--red); }

/* mint */
.mclans { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.mc { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 4px 10px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); transition: border-color .15s, transform .12s; }
.mc:hover { border-color: #444; }
.mc[aria-checked=true] { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #0d0d0d); }
.mc .sig { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--c); color: var(--f); }
.mc .sig svg { width: 18px; height: 18px; }
.mc b { font: 800 10.5px/1 var(--display); }
.mc span { font: 600 10px/1 var(--ui); color: var(--muted); }
.mc:disabled { opacity: .35; cursor: default; }
.mc .soon { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); padding: 3px 6px; border-radius: 5px; background: #222; color: var(--muted); font: 700 8.5px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.qty { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px 14px; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.q-l { font: 800 12px/1 var(--display); }
.q-c { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.q-c input { width: 74px; height: 38px; border-radius: 10px; border: 1px solid var(--line2); background: #0b0b0b; text-align: center; font: 800 17px/1 var(--display); outline: none; }
.q-c input:focus { border-color: var(--cc); }
.q-p { grid-column: 1 / -1; display: flex; gap: 5px; }
.q-p button { flex: 1; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: #0b0b0b; font: 700 12px/1 var(--ui); color: var(--muted); }
.q-p button:hover { color: var(--txt); border-color: #555; }
.total { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6px; margin: 12px 0 14px; }
.total > div { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.total span { font: 700 10px/1 var(--ui); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.total b { font: 800 18px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.total em { font: 600 12px/1 var(--ui); font-style: normal; color: var(--muted); }
.spin { width: 84px; height: 84px; margin: 26px auto 10px; animation: spin 2.4s cubic-bezier(.6,0,.4,1) infinite; }
.spin svg { width: 100%; height: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }
.reveal { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 46vh; overflow: auto; margin-bottom: 16px; }
.rv { position: relative; border-radius: 12px; overflow: hidden; background: #000; border: 1px solid var(--line); animation: flip .55s cubic-bezier(.3,.8,.3,1) both; }
.rv canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.rv .tg { position: absolute; left: 6px; bottom: 6px; right: 6px; display: flex; justify-content: space-between; align-items: center; }
.rv .tg b { font: 800 9px/1 var(--display); padding: 3px 5px; border-radius: 5px; background: var(--tc, #333); color: var(--tf, #fff); }
.rv .tg span { font: 700 10px/1 var(--ui); color: #fff; text-shadow: 0 1px 2px #000; }
.rv.rare { border-color: var(--core); box-shadow: 0 0 0 1px var(--core), 0 0 24px rgba(254,194,62,.35); }
@keyframes flip { from { transform: perspective(600px) rotateY(90deg); opacity: 0; } }
.d-acts { display: flex; flex-direction: column; gap: 8px; }
.sheet.mint #mGo, .sheet.mint #dGo { background: var(--cc); color: var(--cf); }

/* army */
.sheet.army { width: min(880px, 100%); padding-bottom: 0; }
.a-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-right: 44px; }
.a-h h2 { margin: 0; }
.a-f { display: flex; gap: 5px; flex-wrap: wrap; }
.a-f button { height: 30px; padding: 0 11px; border-radius: 9px; border: 1px solid var(--line2); background: #0b0b0b; font: 700 12px/1 var(--ui); color: var(--muted); }
.a-f button[aria-selected=true] { background: var(--txt); color: #000; border-color: var(--txt); }
.a-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding-bottom: 18px; }
.wc { position: relative; display: flex; flex-direction: column; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); overflow: hidden; text-align: left; padding: 0; }
.wc:hover { border-color: #444; }
.wc.sel { border-color: var(--cc); box-shadow: 0 0 0 1px var(--cc); }
.wc canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #000; }
.wc .wi { padding: 8px 9px 9px; display: flex; flex-direction: column; gap: 6px; }
.wc .wt { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.wc .wt b { font: 800 12px/1 var(--display); }
.wc .tier { font: 800 8.5px/1 var(--display); padding: 3px 5px; border-radius: 5px; background: var(--tc, #333); color: var(--tf, #fff); }
.wc .ws { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; font: 700 9.5px/1.25 var(--ui); color: var(--muted); text-align: center; }
.wc .ws b { display: block; font: 800 11px/1.1 var(--display); color: var(--txt); }
.wc .wst { font: 600 11px/1.2 var(--ui); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc .wst.zone { color: var(--cc); } .wc .wst.march { color: #fff; } .wc .wst.siege { color: var(--red); } .wc .wst.hurt { color: var(--dim); }
.wc .ck { position: absolute; top: 7px; right: 7px; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid #fff; background: rgba(0,0,0,.6); display: grid; place-items: center; font: 800 12px/1 var(--ui); padding: 0; }
.wc.sel .ck { background: var(--cc); border-color: var(--cc); color: var(--cf); }
.wc.foreign { opacity: .55; }
.a-bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; margin: 0 -26px; padding: 12px 26px calc(12px + env(safe-area-inset-bottom)); background: rgba(10,10,10,.97); border-top: 1px solid var(--line2); }
.a-bar span { flex: 1; font: 700 13px/1 var(--ui); }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); font: 600 14px/1.5 var(--ui); grid-column: 1 / -1; }

/* rules */
.rl { margin: 6px 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 11px; color: #bdb9b0; font-size: 14px; }
.rl b { color: var(--txt); }
.rl em { font-style: normal; color: var(--core); font-weight: 700; }
.rings { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.rings div { padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font: 600 11px/1.3 var(--ui); color: var(--muted); }
.rings b { display: block; color: var(--txt); font: 800 11px/1.3 var(--display); margin-bottom: 4px; }

/* board */
.sheet.board { width: min(620px, 100%); }
.b-clans { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0 16px; }
.bc { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: 12px; background: var(--card); border-top: 3px solid var(--c); font: 600 10.5px/1.25 var(--ui); color: var(--muted); }
.bc b { color: var(--txt); font: 800 11px/1.2 var(--display); }
.bc .r { font: 800 15px/1 var(--display); color: var(--c); }
.b-top { width: 100%; border-collapse: collapse; font: 600 13px/1.3 var(--ui); }
.b-top th { text-align: left; padding: 6px 6px; font: 700 10px/1 var(--ui); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line2); }
.b-top td { padding: 8px 6px; border-bottom: 1px solid #181818; font-variant-numeric: tabular-nums; }
.b-top td:nth-child(2) { display: flex; align-items: center; gap: 8px; }
.b-top td i { width: 10px; height: 10px; flex: none; background: var(--c); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.b-top tr.me td { color: var(--cc); }

/* wallet sheet (wallet.js) */
.wmodal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; padding: 18px; background: rgba(0,0,0,.72); }
.wmodal.open { display: grid; }
.wsheet { position: relative; width: min(400px, 100%); max-height: calc(100% - 20px); overflow: auto; overscroll-behavior: contain; background: #0b0b0b; border: 1px solid var(--line2); border-radius: 20px; padding: 18px; }
.wx { position: absolute; top: 11px; right: 11px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line2); background: #111; color: var(--muted); font: 600 19px/1 var(--ui); }
.wx:hover { color: var(--txt); border-color: #555; }
.wtitle { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; padding-right: 40px; min-height: 22px; font: 800 15px/1 var(--display); }
.wtitle .mute { font: 600 12px/1 var(--ui); color: var(--muted); }
.wrow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; margin-bottom: 6px; border-radius: 12px; border: 1px solid var(--line2); background: #121212; text-decoration: none; font: 700 14px/1.2 var(--ui); text-align: left; color: var(--txt); }
.wrow:hover { border-color: #555; }
.warr { margin-left: auto; color: var(--muted); }
.wicon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #222; overflow: hidden; flex: none; }
.wicon img { width: 100%; height: 100%; }
.wnote { margin: 4px 0 12px; color: var(--muted); font: 600 13px/1.45 var(--ui); }
.wfield { display: flex; gap: 6px; margin-bottom: 8px; }
.wfield input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line2); background: #0b0b0b; font: 700 14px/1 var(--ui); outline: none; }
.wfield input:focus { border-color: var(--cc); }
.wstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.wstats div { padding: 10px; border-radius: 12px; background: #121212; border: 1px solid var(--line); font: 600 10.5px/1.3 var(--ui); color: var(--muted); }
.wstats b { display: block; color: var(--txt); font: 800 14px/1.2 var(--display); }

/* toast */
.toast { position: fixed; z-index: 95; left: 50%; bottom: 26px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 14px; background: #f3f0e8; color: #000; font: 700 13.5px/1.35 var(--ui); box-shadow: 0 16px 40px rgba(0,0,0,.6); transition: transform .25s, opacity .25s; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #000; }

/* report flash (your battle) */
.rep { position: fixed; z-index: 40; left: 50%; top: calc(var(--top-h) + 8px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 14px; background: #000; border: 1.5px solid var(--c, var(--cc)); font: 700 13px/1.3 var(--ui); box-shadow: 0 14px 34px rgba(0,0,0,.6); animation: rise .3s ease; pointer-events: none; max-width: min(92vw, 460px); }
.rep b { font: 800 13px/1 var(--display); color: var(--c, var(--cc)); }

/* ---------- small screens: the panel becomes a bottom sheet ---------- */
@media (max-width: 1180px) { .feed { width: 260px; } .war { right: 300px; } }
@media (max-width: 980px) {
  :root { --top-h: 64px; --safe-t: max(0px, env(safe-area-inset-top)); }
  .top { padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); padding-top: max(12px, env(safe-area-inset-top)); gap: 8px; }
  .wm { font-size: 19px; }
  .mk { width: 30px; height: 30px; }
  .zoomers { display: none; }
  .war { left: 12px; right: 12px; top: calc(var(--top-h) + var(--safe-t)); bottom: auto; max-width: none; }
  .war-t { margin-bottom: 6px; }
  .war-bar { height: 22px; }
  .seg { font-size: 10px; padding: 0 6px; min-width: 24px; gap: 4px; }
  /* war feed: one live line under the territory bar; tap it to drop the list down over the map */
  .feed { z-index: 19; top: calc(var(--top-h) + 45px + var(--safe-t)); left: 12px; right: 12px; width: auto; max-height: none; padding: 0 10px 0 12px; border-radius: 13px; }
  .feed-h { min-height: 34px; margin-bottom: 0; }
  .feed.min { padding-bottom: 0; }
  .feed:not(.min) { padding-bottom: 6px; }
  .feed:not(.min) ol { max-height: 46vh; max-height: 46dvh; }
  .clock { position: fixed; left: 50%; transform: translateX(-50%); top: max(12px, env(safe-area-inset-top)); }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 48vh; max-height: 48dvh; border-radius: 22px 22px 0 0; border-bottom: 0; padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); transition: max-height .3s cubic-bezier(.3,.8,.3,1); }
  .panel.open { max-height: 82vh; max-height: 82dvh; }
  .grab { display: flex; justify-content: center; width: 100%; height: 28px; margin: 0 0 2px; padding: 0; border: 0; background: none; touch-action: none; }
  .grab i { width: 40px; height: 4px; margin-top: 10px; border-radius: 2px; background: #3a3a3a; }
  .hero h1 { font-size: 22px; margin: 10px 0 8px; }
  .lead { font-size: 13.5px; margin-bottom: 12px; }
  .rep { top: calc(var(--top-h) + 90px + var(--safe-t)); }
  .toast { bottom: auto; top: calc(var(--top-h) + 90px + var(--safe-t)); transform: translate(-50%, -20px); }
  .toast.on { transform: translate(-50%, 0); }
}
/* phones held sideways: the panel moves to the left like on desktop, so the map keeps its height */
@media (max-width: 980px) and (max-height: 520px) and (orientation: landscape) {
  :root { --side-w: min(330px, 42vw); }
  .panel { top: calc(var(--top-h) + var(--safe-t)); bottom: 0; left: 0; right: auto; width: var(--side-w); max-height: none; border-radius: 0 18px 0 0; border-left: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); transition: none; }
  .panel.open { max-height: none; }
  .grab { display: none; }
  .war, .feed { left: calc(var(--side-w) + 12px); right: max(12px, env(safe-area-inset-right)); }
  .hero h1 { font-size: 19px; }
  .modal { padding: 8px; }
  .sheet { max-height: calc(100% - 4px); padding: 20px; }
}
@media (max-width: 560px) {
  .wm { display: none; }
  .s-hide { display: none !important; }
  .ck { padding: 0 8px; gap: 5px; }
  .ck-l { display: none; }
  .clock { position: static; transform: none; }
  .modal { padding: 0; place-items: end stretch; }
  .sheet { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  .war-t em { margin-left: 0; }
  .feed.min .feed-t > b { display: none; }
  .sheet.army { width: 100%; }
  .a-bar { margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
  .mclans { gap: 4px; }
  .mc { padding: 10px 2px 8px; }
  .mc .sig { width: 30px; height: 30px; }
  .mc b { font-size: 9px; }
  .a-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .b-clans { grid-template-columns: repeat(3, 1fr); }
  .rings { grid-template-columns: repeat(2, 1fr); }
  .z-stats b { font-size: 16px; }
  .army-sum .as span { font-size: 9px; letter-spacing: .02em; }
}
@media (max-width: 560px) {
  .top-r { gap: 6px; }
  .wbtn { padding: 0 11px; }
  .wbtn.on { display: inline-block; max-width: 112px; line-height: 34px; overflow: hidden; text-overflow: ellipsis; }
  .top-r .btn.cta { padding: 0 12px; }
}
@media (max-width: 420px) {
  html.signed .top-r .btn.cta { display: none; }
  .a-bar { flex-wrap: wrap; row-gap: 8px; }
  .a-bar span { flex-basis: 100%; }
}
@media (max-width: 360px) {
  .top-r .btn.cta { display: none; }
}
/* fingers: roomier small controls, and 16px inputs so iOS doesn't zoom the page on focus */
@media (pointer: coarse) {
  .link { padding: 8px 4px; }
  .o-q button, .q-p button, .a-f button { height: 34px; }
  .wfield input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
