/* evm.zone — early access. Black, flat, shard-cut UI over a live war map. */
:root {
  --bg: #000;
  --panel: rgba(9, 9, 9, .93);
  --card: #111;
  --card2: #161616;
  --line: #222;
  --line2: #333;
  --txt: #ECE9E1;
  --muted: #8d8a83;
  --dim: #5d5b56;
  --core: #FEC23E;
  --red: #ff5a4f;
  --cc: var(--core);   /* your clan colour (set on <html data-clan>) */
  --cf: #000;          /* text on your clan colour */
  --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: 440px;
  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; }
.clan[data-k=robinhood], .cpill[data-k=robinhood], .seg[data-k=robinhood] { --c: #C8F542; --f: #000; }
.clan[data-k=ethereum], .cpill[data-k=ethereum], .seg[data-k=ethereum] { --c: #A396FF; --f: #000; }
.clan[data-k=base], .cpill[data-k=base], .seg[data-k=base] { --c: #2A63FE; --f: #fff; }
.clan[data-k=arc], .cpill[data-k=arc], .seg[data-k=arc] { --c: #FE7A2F; --f: #000; }
.clan[data-k=ink], .cpill[data-k=ink], .seg[data-k=ink] { --c: #F2469C; --f: #000; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
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; }
[hidden] { display: none !important; }
.resume #intro { display: none; }

#map { position: fixed; top: 0; left: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .7s ease; }
#map.on { opacity: 1; }

/* ---------- compat bands ---------- */
.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; }

/* ---------- header ---------- */
.top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 28px; padding-top: max(20px, env(safe-area-inset-top)); pointer-events: none; }
.top > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--txt); }
.mk { width: 38px; height: 38px; display: block; }
.wm { font: 800 25px/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; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px; background: rgba(12,12,12,.85); border: 1px solid var(--line2); font: 600 13px/1 var(--ui); white-space: nowrap; text-decoration: none; color: var(--muted); }
.chip b { font: 800 14px/1 var(--display); color: var(--txt); letter-spacing: -.01em; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 0 3px rgba(61,220,132,.18); animation: pulse 1.6s ease-in-out infinite; }
.xlink { color: var(--txt); }
.xlink:hover { border-color: #555; }
.xi { width: 15px; height: 15px; fill: currentColor; flex: none; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }

/* ---------- clan war bar ---------- */
.war { position: fixed; z-index: 15; left: calc(var(--panel-w) + 56px); right: 28px; bottom: 24px; max-width: 680px; 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-t em { font-style: normal; color: var(--dim); margin-left: 6px; }
.war-t b { font: 800 11px/1 var(--display); letter-spacing: .06em; color: var(--txt); white-space: nowrap; }
.war-t b i { font-style: normal; color: var(--hc, var(--core)); }
.war-bar { display: flex; gap: 4px; height: 12px; }
.seg { height: 100%; background: var(--c); border-radius: 3px; transition: flex-grow 1.2s cubic-bezier(.3,.8,.3,1); min-width: 6px; }
.war-l { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
.war-l span { display: inline-flex; align-items: center; gap: 5px; font: 700 12px/1 var(--ui); color: var(--muted); white-space: nowrap; }
.war-l span svg { width: 13px; height: 13px; color: var(--c); }
.war-l span b { color: var(--txt); font-weight: 700; }

/* ---------- nameplate ---------- */
.tag { position: fixed; z-index: 12; left: 0; top: 0; transform: translate(-50%, -100%); pointer-events: none; background: #000; border: 1.5px solid var(--cc); border-radius: 10px; padding: 6px 11px 7px; text-align: center; white-space: nowrap; will-change: transform; transition: opacity .25s; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.tag::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: #000; border-right: 1.5px solid var(--cc); border-bottom: 1.5px solid var(--cc); transform: rotate(45deg); }
.tag b { display: block; font: 800 13px/1.15 var(--display); letter-spacing: -.01em; }
.tag span { display: block; font: 700 10px/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--cc); margin-top: 2px; }
.tag.pop { animation: pop .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 0% { transform: translate(-50%, -100%) scale(.2); } }

/* ---------- panel ---------- */
.panel {
  position: fixed; z-index: 30; left: 28px; top: 86px; max-height: calc(100% - 114px); width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.panel > section { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #333 transparent; padding: 26px 26px 24px; min-height: 0; flex: 0 1 auto; }
.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: 8px; height: 8px; background: var(--core); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); animation: pulse 1.4s infinite; }
.intro h1 { font: 800 33px/1.08 var(--display); letter-spacing: -.025em; margin: 14px 0 12px; }
.intro h1 em { font-style: normal; color: var(--core); }
.lead { margin: 0 0 18px; color: var(--muted); font-size: 15px; }

/* clan picker */
.pick-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.pick-h b { font: 800 12px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.pick-h span { font: 600 12px/1 var(--ui); color: var(--dim); }
.clans { display: grid; gap: 6px; }
.clan { position: relative; display: grid; grid-template-columns: 30px 1fr auto; grid-template-rows: auto auto; align-items: center; column-gap: 12px; row-gap: 5px; width: 100%; padding: 7px 13px 8px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; text-align: left; transition: background .15s, border-color .15s, transform .15s; }
.clan .sig { grid-row: 1 / 3; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: #000; color: var(--c); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); transition: background .15s, color .15s; }
.clan .sig svg { width: 15px; height: 15px; margin-top: 3px; }
.clan .cn { font: 800 14px/1 var(--display); letter-spacing: -.01em; }
.clan .cw { font: 600 12.5px/1 var(--ui); color: var(--muted); text-align: right; white-space: nowrap; }
.clan .cw b { color: var(--txt); font-weight: 700; }
.clan .cbar { grid-column: 2 / 4; height: 4px; border-radius: 4px; background: #1d1d1d; overflow: hidden; }
.clan .cbar i { display: block; height: 100%; width: 20%; background: var(--c); border-radius: 4px; transition: width 1s cubic-bezier(.3,.8,.3,1); }
.clan:hover { border-color: #3a3a3a; background: var(--card2); }
.clan.sel { background: var(--c); border-color: var(--c); color: var(--f); }
.clan.sel .sig { background: var(--f); color: var(--c); }
.clan.sel .cw, .clan.sel .cw b { color: var(--f); }
.clan.sel .cbar { background: rgba(0,0,0,.18); }
.clan.sel .cbar i { background: var(--f); }
.clans.dim .clan:not(.sel) { opacity: .55; }
.clans.dim .clan:not(.sel):hover { opacity: 1; }
.clans.shake { animation: shake .4s; }
.cdesc { min-height: 20px; margin: 9px 2px 14px; font: 600 13px/1.4 var(--ui); color: var(--muted); }
.cdesc b { color: var(--txt); }
.cdesc q { color: var(--cc); quotes: '“' '”'; }

.connect { display: grid; gap: 10px; }
.field { display: flex; align-items: center; height: 58px; border: 1px solid var(--line2); border-radius: 14px; background: #050505; padding: 0 16px; transition: border-color .15s, box-shadow .15s; }
.field:focus-within { border-color: var(--cc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc) 25%, transparent); }
.field .at { font: 800 20px/1 var(--display); color: var(--dim); margin-right: 6px; }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 600 18px/1 var(--ui); color: var(--txt); padding: 0; }
.field input::placeholder { color: #55534e; }
.connect.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.msg { min-height: 20px; margin: 10px 2px 0; font: 600 13.5px/1.35 var(--ui); color: var(--muted); }
.msg.err { color: var(--red); }
.msg.ok { color: var(--txt); }
.fine { margin: 2px 2px 0; font: 600 12px/1.4 var(--ui); color: var(--dim); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 48px; padding: 0 18px; border: 0; border-radius: 13px; background: var(--cc); color: var(--cf); font: 800 14px/1 var(--display); letter-spacing: -.005em; text-decoration: none; cursor: pointer; transition: transform .08s, filter .15s, background .15s; -webkit-user-select: none; user-select: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px) scale(.99); }
.btn.big { height: 58px; font-size: 16px; width: 100%; }
.btn .arr { width: 20px; height: 20px; }
.btn.ghost { background: transparent; color: var(--txt); border: 1px solid var(--line2); }
.btn.ghost:hover { border-color: #555; filter: none; }
.btn.dark { background: #1c1c1c; color: var(--txt); }
.btn.sm { height: 38px; padding: 0 13px; font-size: 12.5px; border-radius: 11px; }
.btn.off, .btn:disabled { opacity: .4; pointer-events: none; }
.link { display: inline-flex; align-items: center; min-height: 36px; background: none; border: 0; padding: 0 8px; margin: -6px -6px; cursor: pointer; font: 600 12.5px/1 var(--ui); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--txt); }

/* recent ticker */
.recent { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); overflow: hidden; }
.rl { flex: none; font: 700 10.5px/1 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.rtrack { flex: 1; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.rrun { display: inline-flex; gap: 18px; white-space: nowrap; animation: run 40s linear infinite; font: 600 13px/1 var(--ui); }
.rrun span { display: inline-flex; align-items: center; gap: 6px; }
.rrun span i { width: 8px; height: 8px; background: var(--c); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
.rrun span b { color: var(--dim); font-weight: 600; }
@keyframes run { to { transform: translateX(-50%); } }

/* ---------- quest ---------- */
.me { display: flex; align-items: center; gap: 13px; }
.pf { width: 64px; height: 64px; flex: none; border-radius: 16px; overflow: hidden; background: #000; border: 1px solid var(--line2); }
.pf canvas { width: 100%; height: 100%; display: block; }
.me-t { flex: 1; min-width: 0; }
.me-t b { display: block; font: 800 21px/1.1 var(--display); letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-t > span { display: flex; align-items: center; gap: 8px; margin-top: 6px; font: 600 13px/1 var(--ui); color: var(--muted); }
.cpill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 7px; border-radius: 999px; background: var(--c); color: var(--f); font: 800 10.5px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.cpill svg { width: 12px; height: 12px; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 16px; }
.traits span { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line2); font: 600 11.5px/1.2 var(--ui); color: var(--muted); }
.traits span.t0 { border-color: transparent; background: var(--tc, #3a3a3a); color: var(--tf, var(--txt)); font-weight: 700; letter-spacing: .04em; }
.prog { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: #070707; margin-bottom: 12px; }
.pmark { width: 46px; height: 46px; flex: none; }
.pmark path { fill: #232323; transition: fill .4s; }
.pmark path.on { fill: var(--pc); }
.pmark.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.18) rotate(-6deg); } }
.prog-t { flex: 1; min-width: 0; }
.prog-t b { display: block; font: 800 19px/1.1 var(--display); letter-spacing: -.02em; }
.prog-t > span { display: block; font: 600 12px/1.3 var(--ui); color: var(--muted); margin-top: 3px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 11px 10px 10px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); transition: background .2s, opacity .2s, border-color .2s; }
.st .ic { width: 40px; height: 40px; display: grid; place-items: center; }
.st .ic svg { width: 38px; height: 38px; }
.st .ic svg path { fill: #262626; }
.st .ic svg path.hi { fill: var(--pc); }
.st .tt { min-width: 0; }
.st .tt b { display: block; font: 800 13.5px/1.15 var(--display); letter-spacing: -.01em; }
.st .tt span { display: block; font: 600 12.5px/1.3 var(--ui); color: var(--muted); margin-top: 3px; }
.st .act { display: flex; align-items: center; gap: 8px; }
.st .rw { font: 700 11.5px/1 var(--ui); color: var(--muted); white-space: nowrap; }
.st .state { font: 700 12px/1 var(--ui); white-space: nowrap; color: var(--muted); }
.st.locked { opacity: .45; }
.st.locked .ic svg path.hi { fill: #3a3a3a; }
.st.ready { border-color: var(--cc); background: #0e0e0e; box-shadow: 0 0 0 1px var(--cc) inset; }
.st.ready .ic { animation: nudge 2.6s ease-in-out infinite; }
.st.busy { border-color: var(--line2); }
.st.done { background: #0a0a0a; }
.st.done .tt b { color: var(--muted); }
.st.done .state { color: var(--txt); }
.st.done .state::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--cc); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); }
@keyframes nudge { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-12deg); } 86% { transform: rotate(9deg); } 94% { transform: rotate(-4deg); } }
.st .more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font: 600 12px/1.3 var(--ui); color: var(--muted); padding-top: 2px; }
.st .more .btn { height: 34px; font-size: 11.5px; padding: 0 11px; border-radius: 10px; }
.wform { grid-column: 1 / -1; display: flex; gap: 8px; }
.wform input { flex: 1; min-width: 0; height: 46px; border: 1px solid var(--line2); border-radius: 12px; padding: 0 12px; background: #050505; font: 600 13.5px/1 var(--mono); outline: none; color: var(--txt); }
.wform input:focus { border-color: var(--cc); }
.wform .btn { height: 46px; }
.wmsg { grid-column: 1 / -1; font: 600 12px/1.3 var(--ui); color: var(--dim); margin-top: -2px; }
.wmsg.err { color: var(--red); }
.st.claim .cbtn { grid-column: 1 / -1; width: 100%; height: 52px; font-size: 15px; }

/* ---------- card / done ---------- */
.win { position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.72); animation: fade .3s ease; overflow: auto; }
.done-in { width: min(760px, 100%); background: #0a0a0a; border: 1px solid var(--line2); border-radius: 26px; padding: 26px; text-align: center; box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.02); animation: rise .5s cubic-bezier(.3,1.3,.5,1); max-height: 100%; overflow: auto; }
.win h2 { font: 800 clamp(22px, 4vw, 34px)/1.1 var(--display); margin: 14px 0 6px; letter-spacing: -.02em; }
.ds { margin: 0 0 18px; font: 600 14px/1.4 var(--ui); color: var(--muted); }
.ds b { color: var(--cc); }
.dimg { border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 1200 / 630; border: 1px solid var(--line); }
.dimg img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dacts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 20px 0 12px; }
.dref { margin: 0; font: 600 12.5px/1.4 var(--ui); color: var(--muted); word-break: break-all; }
.dref code { font: 600 12.5px/1.4 var(--mono); color: var(--txt); background: #161616; padding: 2px 7px; border-radius: 6px; }
.dclose { margin-top: 12px; }
.win.preview .kicker, .win.preview .dref { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px) scale(.95); opacity: 0; } }

/* ---------- toast, flash, flyers ---------- */
.toast { position: fixed; z-index: 80; left: calc(50% + var(--panel-w) / 2 + 14px); bottom: 104px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: var(--txt); color: #000; padding: 12px 18px; border-radius: 13px; font: 700 14px/1.3 var(--ui); transition: .25s; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast b { font-weight: 700; color: #000; }
.flash { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; left: 0; background: var(--cc); opacity: 0; pointer-events: none; }
.flash.go { animation: flash .7s ease-out; }
@keyframes flash { 0% { opacity: .5; } 100% { opacity: 0; } }
.flyer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; pointer-events: none; }
.flyer i { position: absolute; left: 0; top: 0; width: 16px; height: 16px; background: var(--pc); clip-path: polygon(50% 0, 100% 38%, 81% 100%, 19% 100%, 0 38%); will-change: transform; }

/* ================= responsive =================
   side panel  : desktop, tablet landscape
   bottom sheet: phones in portrait (≤760) + tablets in portrait (centred)
   compact side: phones in landscape (short screens)
   app.js mirrors these queries in isSheet() to keep the map clear of the panel. */
@media (max-width: 1180px) and (min-width: 761px) { :root { --panel-w: 400px; } .intro h1 { font-size: 31px; } }
@media (pointer: coarse) {
  .wform input { font-size: 16px; }
  .btn:hover { filter: none; }
  .clan:hover { border-color: var(--line); background: var(--card); }
  .clan.sel:hover { background: var(--c); border-color: var(--c); }
}

/* ---------- bottom sheet ---------- */
@media (max-width: 760px), (max-width: 1024px) and (orientation: portrait) {
  .top { padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .mk { width: 30px; height: 30px; }
  .wm { font-size: 20px; }
  .brand { gap: 8px; }
  .chip { height: 32px; padding: 0 11px; font-size: 12px; }
  .chip b { font-size: 13px; }
  .s-hide { display: none; }
  .xlink { padding: 0 9px; }
  .war { left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 44px); bottom: auto; max-width: none; }
  .war-t { margin-bottom: 6px; font-size: 10px; }
  .war-t b { font-size: 10px; }
  .war-bar { height: 7px; gap: 3px; }
  .war-l { margin-top: 6px; }
  .war-l span { font-size: 11px; gap: 4px; }
  .war-l span svg { width: 11px; height: 11px; }
  .war-l span b { display: none; }
  .panel {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 58%;
    border-radius: 22px 22px 0 0; border-bottom: 0;
    box-shadow: 0 -20px 50px rgba(0,0,0,.6);
  }
  .panel > section { padding: 16px max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .panel::before { content: ''; display: block; flex: none; width: 40px; height: 4px; border-radius: 9px; background: #333; margin: 9px auto 0; }
  .intro .kicker { display: none; }
  .intro h1 { font-size: 22px; margin: 4px 0 8px; line-height: 1.12; }
  .intro h1 br { display: none; }
  .lead { font-size: 13.5px; margin-bottom: 14px; }
  .pick-h { margin-bottom: 8px; }
  .clans { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .clan { grid-template-columns: 1fr; grid-template-rows: auto auto; justify-items: center; row-gap: 7px; padding: 10px 2px 9px; border-radius: 13px; text-align: center; }
  .clan .sig { grid-row: auto; width: 32px; height: 32px; }
  .clan .cn { font-size: 10px; letter-spacing: 0; }
  .clan .cw, .clan .cbar { display: none; }
  .cdesc { margin: 9px 2px 12px; font-size: 12.5px; }
  .field { height: 52px; }
  .field input { font-size: 17px; }
  .btn.big { height: 52px; font-size: 15px; }
  .fine { display: none; }
  .recent { margin-top: 12px; padding-top: 10px; }
  .me { gap: 11px; }
  .pf { width: 52px; height: 52px; border-radius: 13px; }
  .me-t b { font-size: 18px; }
  .traits { margin: 10px 0 12px; }
  .traits span { font-size: 11px; padding: 4px 8px; }
  .prog { padding: 9px 10px 9px 11px; gap: 11px; margin-bottom: 10px; }
  .pmark { width: 38px; height: 38px; }
  .prog-t b { font-size: 16px; }
  .prog-t > span { font-size: 11.5px; }
  .st { grid-template-columns: 36px 1fr auto; gap: 10px; padding: 8px 9px 8px 8px; border-radius: 13px; }
  .st .ic, .st .ic svg { width: 34px; height: 34px; }
  .st .tt b { font-size: 12.5px; }
  .st .tt span { font-size: 12px; }
  .st .rw { display: none; }
  .st.done .rw { display: inline; }
  .win { padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); align-items: flex-end; }
  .done-in { padding: 18px 14px; border-radius: 22px; }
  .win h2 { font-size: 21px; }
  .dacts { margin: 16px 0 10px; }
  .dacts .btn { flex: 1 1 40%; height: 46px; font-size: 13px; }
  .toast { left: 50%; bottom: calc(var(--sheet, 0px) + 12px); font-size: 13px; padding: 10px 14px; }
}
/* tablets in portrait: a centred, roomier sheet */
@media (min-width: 761px) and (max-width: 1024px) and (orientation: portrait) {
  .panel { left: 50%; right: auto; width: min(620px, calc(100% - 40px)); transform: translateX(-50%); max-height: 52%; border: 1px solid var(--line); border-bottom: 0; }
  .intro h1 { font-size: 28px; }
  .clan .cn { font-size: 12px; }
  .win { align-items: center; }
}
/* short phones in portrait */
@media (max-width: 760px) and (max-height: 680px) and (orientation: portrait) {
  .lead, .traits { display: none; }
  .panel { max-height: 62%; }
  .war-l { display: none; }
}
/* narrow phones */
@media (max-width: 360px) {
  .wm { font-size: 17px; }
  .chip { padding: 0 8px; }
  .chip span:last-child { display: none; }
  .clan .cn { font-size: 8.5px; }
  .clan .sig { width: 28px; height: 28px; }
  .st { grid-template-columns: 30px 1fr auto; gap: 8px; }
  .st .ic, .st .ic svg { width: 30px; height: 30px; }
  .st .act .btn .xi { display: none; }
  .btn.sm { padding: 0 10px; }
  .dacts .btn { flex: 1 1 100%; }
  .war-l span b, .war-t em { display: none; }
}

/* ---------- phones in landscape: compact side panel ---------- */
@media (max-height: 500px) and (min-width: 561px) and (orientation: landscape) {
  :root { --panel-w: min(340px, 46vw); }
  .top { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); padding-left: calc(var(--panel-w) + 22px + env(safe-area-inset-left)); }
  .mk { width: 26px; height: 26px; }
  .wm { font-size: 17px; }
  .chip { height: 30px; padding: 0 9px; font-size: 11.5px; }
  .s-hide { display: none; }
  .war { left: calc(var(--panel-w) + 24px + env(safe-area-inset-left)); right: 14px; bottom: 8px; }
  .war-t { margin-bottom: 5px; }
  .war-bar { height: 6px; }
  .war-l { display: none; }
  .panel { left: max(10px, env(safe-area-inset-left)); top: max(10px, env(safe-area-inset-top)); bottom: max(10px, env(safe-area-inset-bottom)); max-height: none; width: var(--panel-w); border-radius: 18px; }
  .panel > section { padding: 14px 13px; }
  .kicker, .lead, .fine, .traits, .pick-h span { display: none; }
  .intro h1 { font-size: 18px; margin: 0 0 8px; }
  .intro h1 br { display: none; }
  .clans { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .clan { grid-template-columns: 1fr; justify-items: center; row-gap: 5px; padding: 7px 2px; border-radius: 11px; }
  .clan .sig { grid-row: auto; width: 26px; height: 26px; }
  .clan .sig svg { width: 13px; height: 13px; }
  .clan .cn { font-size: 8px; letter-spacing: 0; }
  .clan .cw, .clan .cbar { display: none; }
  .cdesc { margin: 6px 0 8px; font-size: 11.5px; min-height: 0; }
  .connect { gap: 7px; }
  .field { height: 44px; }
  .field input { font-size: 16px; }
  .btn.big { height: 44px; font-size: 13px; }
  .msg { margin-top: 6px; font-size: 12px; min-height: 0; }
  .recent { margin-top: 8px; padding-top: 8px; }
  .pf { width: 42px; height: 42px; border-radius: 11px; }
  .me-t b { font-size: 15px; }
  .prog { padding: 7px 9px; margin: 9px 0 8px; }
  .pmark { width: 32px; height: 32px; }
  .prog-t b { font-size: 14px; }
  .prog-t > span { display: none; }
  .steps { gap: 6px; }
  .st { grid-template-columns: 30px 1fr auto; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 12px; }
  .st .ic, .st .ic svg { width: 28px; height: 28px; }
  .st .tt b { font-size: 11.5px; }
  .st .tt span { font-size: 11px; }
  .st .rw { display: none; }
  .btn.sm { height: 34px; font-size: 11.5px; padding: 0 10px; }
  .wform input, .wform .btn { height: 40px; }
  .win { padding: 10px; }
  .done-in { padding: 12px 14px; border-radius: 18px; width: min(640px, 100%); }
  .win .kicker { display: none; }
  .win h2 { font-size: 18px; margin: 2px 0 4px; }
  .ds { margin-bottom: 8px; font-size: 12.5px; }
  .dimg { width: min(100%, calc((100vh - 190px) * 1.905)); margin: 0 auto; }
  .dref { display: none; }
  .dclose { margin-top: 2px; }
  .dacts { margin: 10px 0 6px; gap: 8px; }
  .dacts .btn { height: 38px; font-size: 12px; padding: 0 12px; }
  .toast { bottom: 34px; left: calc(var(--panel-w) + (100% - var(--panel-w)) / 2); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
