/* Home (lobby) — Overdrive Chronicle
   Layout follows the genre: key art and the Leader fill the screen, the UI hugs the edges.
   top bar (profile · wallet · menu) / side (news) / dock (feature tiles) / Battle bottom-right.

   Spacing is a scale, not one gap everywhere (plan: docs/HOME-UI-PLAN-16.md):
   --s1 4   icon ↔ its own label, number ↔ "+"
   --s2 8   items inside one group (wallet pills, tiles in a dock group)
   --s3 12  padding inside pills and small panels
   --s4 16  between related groups; screen edge on phones
   --s5 24  between unrelated zones; panel padding on desktop; screen edge on desktop
   --s6 32  between dock groups; around the Battle button
   --s7 48  breathing room on large screens
   Rule: the gap inside a group is always smaller than the gap around it.
   Thai text: body line-height 1.55, labels 1.3, one-line buttons 1.25. */

.home{
  /* --s1..--s7, colours, text, --ink, --line, --tap: public/tokens.css (loaded first) */
  --edge-x:max(var(--s5),var(--xsl,env(safe-area-inset-left)),var(--xsr,env(safe-area-inset-right)));
  --edge-y:var(--s4);
  position:fixed;inset:0;overflow:hidden;color:var(--text);
  font:500 15px/1.55 'Kanit','Leelawadee UI',Tahoma,sans-serif;
  background:#08111a;isolation:isolate;
  /* Thai has no spaces between words: break only between phrases, so a word is never split (การัน|ตี) */
  word-break:keep-all;overflow-wrap:anywhere;
}
.home[hidden]{display:none}
.home :where(button){font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.home :where(button):focus-visible{outline:2px solid var(--gold-1);outline-offset:3px}

/* the painted scene; only the top and bottom edges are darkened, the middle stays the picture */
.hm-art{position:absolute;inset:0;z-index:-1;
  background:
    linear-gradient(180deg,#050a11d0 0,#050a1100 22%,#050a1100 58%,#050a11e6 100%),
    linear-gradient(90deg,#050a1166 0,#050a1100 30%,#050a1100 64%,#050a1199 100%),
    url('assets/bg-home-pool.webp') 50% 30%/cover no-repeat}
@media (max-width:1100px){:where(body:not(.xr-staged)) .hm-art{background:
    linear-gradient(180deg,#050a11d0 0,#050a1100 24%,#050a1100 56%,#050a11ee 100%),
    linear-gradient(90deg,#050a1166 0,#050a1100 30%,#050a1100 64%,#050a11aa 100%),
    url('assets/bg-home-pool-s.webp') 50% 30%/cover no-repeat}}
/* owner 2026-11-27: the home scene is the painted background alone, no leader standee in front of it
   (start-screen.js still fills #start-leader-preview; delete this line to bring the standee back) */
.hm-leader{display:none}

/* ---------- top bar ---------- */
.hm-top{position:absolute;z-index:3;top:var(--edge-y);left:var(--edge-x);right:var(--edge-x);display:flex;align-items:center;justify-content:space-between;gap:var(--s4)}
.hm-brand{display:flex;align-items:center;gap:var(--s3);min-width:0}
.hm-logo{width:44px;height:44px;border-radius:12px;object-fit:cover;box-shadow:0 0 0 1.5px var(--line-hi),0 6px 16px #000a}
.hm-wordmark{font:700 15px/1.3 'Taviraj',Georgia,serif;letter-spacing:.06em;text-transform:uppercase;color:#fbf0d5}
/* profile: one button, avatar + name + level + slim EXP bar (data comes from OC.profile, see src/home.ts) */
.hm-profile{display:flex;align-items:center;gap:var(--s3);min-width:0;min-height:var(--tap);padding:var(--s1) var(--s4) var(--s1) var(--s1);border:1px solid var(--line);border-radius:999px;background:var(--ink);box-shadow:0 4px 12px #0006;text-align:left}
.hm-profile:hover{border-color:var(--line-hi)}
.hm-avatar{flex:none;width:48px;height:48px;border-radius:50%;object-fit:cover;box-shadow:0 0 0 2px var(--gold-2),0 0 0 4px #0b141e,0 4px 12px #000a}
.hm-avatar.big{width:96px;height:96px;box-shadow:0 0 0 3px var(--gold-2),0 0 0 6px #0b141e,0 8px 22px #000a}
.hm-pf-copy{display:flex;flex-direction:column;gap:var(--s1);min-width:0}
.hm-pf-name{max-width:15ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:600 16px/1.3 'Kanit',sans-serif;color:#fff4dc}
.hm-pf-meter,.hm-pf-level{display:flex;align-items:center;gap:var(--s2)}
.hm-pf-lv{flex:none;font:600 13px/1.3 'Kanit',sans-serif;color:var(--gold-1)}
.hm-pf-lv b{font-weight:700;font-variant-numeric:tabular-nums}
.hm-pf-bar{position:relative;display:block;flex:1;min-width:72px;width:112px;height:6px;border-radius:3px;background:#ffffff26;overflow:hidden}
.hm-pf-bar i{position:absolute;inset:0 auto 0 0;width:var(--pf,0%);min-width:3px;border-radius:3px;background:linear-gradient(90deg,var(--gold-2),var(--gold-1))}
.hm-wallet{display:flex;align-items:center;gap:var(--s2)}
.hm-coin{display:flex;align-items:center;gap:var(--s2);height:40px;padding:0 var(--s1) 0 var(--s2);border:1px solid var(--line);border-radius:20px;background:var(--ink);box-shadow:0 4px 12px #0006}
.hm-coin b{min-width:3.2ch;text-align:right;font:700 16px/1 'Kanit',sans-serif;font-variant-numeric:tabular-nums;letter-spacing:.02em}
.hm-plus{display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:15px;font-size:16px;line-height:1;color:#2c1a05;background:linear-gradient(180deg,var(--gold-1),var(--gold-2))}
.hm-round{font-size:22px;display:grid;place-items:center;width:var(--tap);height:var(--tap);margin-left:var(--s2);border:1px solid var(--line);border-radius:50%;background:var(--ink)}

/* ---------- icons: inline SVG from window.OC.icon (public/icons.js), hydrated from data-oc-icon ---------- */
.hm-ico,.hm-mode-ico,.hm-mode-lock{display:grid;place-items:center;flex:none;font-size:24px;line-height:1}
.hm-ico svg,.hm-mode-ico svg,.hm-mode-lock svg,.hm-plus svg{display:block;width:1em;height:1em}
.hm-ico.coin{color:#f6c95a}
.hm-ico.gem{color:#7fe0ee}

/* ---------- Leader ---------- */
.hm-leader{position:absolute;z-index:1;left:clamp(0px,calc(4*var(--xvw,1vw)),80px);bottom:0;height:min(calc(88*var(--xvh,1vh)),860px);aspect-ratio:812/900;pointer-events:none}
.hm-standee{position:absolute;inset:0;background:center bottom/contain no-repeat;filter:drop-shadow(0 18px 30px #000c);
  -webkit-mask:linear-gradient(180deg,#000 72%,#0000 100%);mask:linear-gradient(180deg,#000 72%,#0000 100%)}

/* ---------- side column: news ---------- */
.hm-side{position:absolute;z-index:2;right:var(--edge-x);top:calc(var(--edge-y) + 48px + var(--s6));width:clamp(220px,calc(24*var(--xvw,1vw)),320px);display:flex;flex-direction:column;gap:var(--s3)}
.hm-banner{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:0;min-height:112px;padding:var(--s4) var(--s4) var(--s3);text-align:left;overflow:hidden;
  border:1px solid var(--line);border-radius:14px;
  background:linear-gradient(100deg,#0b1622f2 30%,#0b162299 62%,#0b162200),url('assets/icon-192.png') right center/auto 100% no-repeat,#0b1622;box-shadow:0 10px 26px #0008}
.hm-banner-kicker{margin-bottom:var(--s1);padding:2px var(--s2);border-radius:6px;font:600 12px/1.3 'Kanit',sans-serif;color:#2c1a05;background:var(--gold-2)}
.hm-banner strong{font:700 22px/1.25 'Taviraj',Georgia,serif;color:#fff4dc}
.hm-banner small{margin-top:2px;font-size:13px;line-height:1.3;color:var(--text-dim)}
.hm-resume,.hm-room{display:flex;align-items:center;justify-content:space-between;gap:var(--s3);min-height:var(--tap);padding:var(--s2) var(--s2) var(--s2) var(--s4);border:1px solid var(--line);border-radius:12px;background:var(--ink)}
.hm-resume[hidden],.hm-room[hidden]{display:none}
.hm-resume p span{white-space:nowrap}
.hm-resume p{margin:0;font-size:13px;line-height:1.35;color:var(--text-dim)}
.hm-resume-go{flex:none;min-height:40px;padding:0 var(--s4);border:1px solid var(--gold-2);border-radius:10px;background:#2a1c0899;color:var(--gold-1);font-weight:600}
.hm-room{width:100%;justify-content:center;font-weight:600;color:var(--gold-1)}
/* ---------- dock: two groups, what works now and what is coming ---------- */
.hm-dock{position:absolute;z-index:2;left:var(--edge-x);bottom:var(--edge-y);display:flex;align-items:flex-end;gap:var(--s2);padding:var(--s2);
  border:1px solid #e2c58930;border-radius:18px;background:linear-gradient(180deg,#0a121bb0,#0a121be8);box-shadow:0 10px 30px #0009;backdrop-filter:blur(6px)}
.hm-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s1);width:72px;height:68px;padding:0;border:0;border-radius:12px;background:none;color:#f1e6cc}
.hm-tile span:not(.hm-ico){font-size:13px;line-height:1.25;white-space:nowrap}
.hm-tile .hm-ico{font-size:28px;color:var(--gold-1)}
.hm-tile:hover{background:#ffffff0d}
.hm-tile:nth-child(4){margin-right:var(--s3)}
.hm-tile:nth-child(4)::after{content:'';position:absolute;right:calc(-1 * var(--s3) / 2 - var(--s1));top:18%;bottom:18%;width:1px;background:#e2c58930}
.hm-tile.soon{color:var(--text-faint)}
.hm-tile.soon .hm-ico{color:#a7a08f}
.hm-tile.soon::before{content:'';position:absolute;top:8px;right:14px;width:7px;height:7px;border-radius:50%;background:#6d6a62;box-shadow:0 0 0 2px #0a121b}

/* ---------- Battle: the one big action, bottom-right where the thumb rests ---------- */
.hm-battle{--cut:18px;position:absolute;z-index:2;right:var(--edge-x);bottom:var(--edge-y);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  width:clamp(220px,calc(22*var(--xvw,1vw)),300px);height:clamp(76px,calc(10*var(--xvh,1vh)),92px);border:0;color:#2c1a05;
  clip-path:polygon(var(--cut) 0,calc(100% - var(--cut)) 0,100% 50%,calc(100% - var(--cut)) 100%,var(--cut) 100%,0 50%);
  background:linear-gradient(180deg,var(--gold-1),var(--gold-2) 52%,var(--gold-3));filter:drop-shadow(0 10px 22px #000b)}
.hm-battle-main{display:flex;align-items:center;gap:var(--s2)}
.hm-battle .hm-ico{font-size:30px}
.hm-battle strong{font:800 30px/1.1 'Taviraj',Georgia,serif;letter-spacing:.04em}
.hm-battle small{font:600 13px/1.25 'Kanit',sans-serif;color:#4a2e08}
.hm-battle:hover{background:linear-gradient(180deg,#fff1c8,#ecbe62 52%,#ab7128)}
.home .hm-battle:focus-visible{outline:none;filter:drop-shadow(0 0 0 #fff) drop-shadow(0 0 8px var(--gold-1))}

/* ---------- sheets: one panel at a time from the right, the scene stays visible behind ---------- */
.hm-scrim{position:absolute;inset:0;z-index:5;background:#03070cb3}
.hm-scrim[hidden]{display:none}
.hm-sheet{position:absolute;z-index:6;top:0;right:0;bottom:0;width:min(460px,calc(64*var(--xvw,1vw)));display:flex;flex-direction:column;gap:var(--s5);
  padding:var(--edge-y) var(--edge-x) var(--s5) var(--s5);overflow-y:auto;overscroll-behavior:contain;
  background:linear-gradient(180deg,#0d1824,#08111a);border-left:1px solid var(--line);box-shadow:-20px 0 50px #000a;animation:hm-in .22s cubic-bezier(.2,.8,.3,1)}
.hm-sheet[hidden]{display:none}
.hm-sheet.wide{width:min(940px,calc(94*var(--xvw,1vw)))}
.hm-sheet.narrow{width:min(380px,calc(64*var(--xvw,1vw)))}
@keyframes hm-in{from{transform:translateX(40px);opacity:0}}
@media (prefers-reduced-motion:reduce){.hm-sheet{animation:none}}
.hm-sheet-head{display:flex;align-items:center;gap:var(--s3);min-height:var(--tap)}
.hm-sheet-head h2{margin:0;font:700 22px/1.3 'Taviraj',Georgia,serif;color:#fff4dc}
.hm-sheet-note{margin-left:auto;font-size:13px;line-height:1.3;color:var(--text-faint)}
.hm-badge{margin-left:auto;padding:2px var(--s2);border-radius:6px;font-size:12px;line-height:1.3;color:#2c1a05;background:var(--gold-2)}
.hm-back{display:grid;place-items:center;width:var(--tap);height:var(--tap);margin-left:calc(-1 * var(--s2));border:0;border-radius:50%;background:none}
.hm-back:hover{background:#ffffff12}

.hm-chip{min-height:44px;padding:0 var(--s3);border:1px solid var(--gold-2);border-radius:10px;background:#2a1c0880;color:var(--gold-1);font-size:14px;font-weight:600}
.hm-chip.ghost{border-color:var(--line);background:none;color:var(--text)}

.hm-link{margin-top:var(--s3);padding:var(--s2) 0;border:0;background:none;color:var(--gold-1);font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:4px;text-decoration-color:#e2b05380}
.hm-leaders-block{display:flex;flex-direction:column;gap:var(--s2)}
.hm-label{font-size:13px;line-height:1.3;letter-spacing:.06em;color:var(--text-faint)}
.home .hm-leaders{display:grid;grid-template-columns:1fr 1fr;gap:var(--s2);margin:0}

/* menu and coming-soon sheets */
.hm-menu-list{display:flex;flex-direction:column;gap:var(--s1)}
.hm-row{display:flex;align-items:center;gap:var(--s3);min-height:56px;padding:0 var(--s3);border:0;border-radius:10px;background:none;text-align:left;font-size:17px;line-height:1.3}
.hm-row .hm-ico{font-size:26px}
.hm-row:hover{background:#ffffff0d}
.hm-row .hm-ico{color:var(--gold-1)}
.hm-soon-text{margin:0;font-size:15px;line-height:1.65;color:#e7dfcc}
.hm-soon-card{display:flex;flex-direction:column;align-items:center;gap:var(--s4);padding:var(--s6) var(--s4);text-align:center;border:1px solid var(--line);border-radius:14px;background:#ffffff08}
.hm-soon-ico{display:grid;place-items:center;width:88px;height:88px;font-size:48px;color:var(--gold-1);border:1px solid var(--line-hi);border-radius:50%;background:radial-gradient(circle,#e2b05326,#0000 70%)}
.hm-soon-ico:empty{display:none}
.hm-soon-ico svg{width:1em;height:1em}
.hm-menu-list+.hm-brand{margin-top:auto;padding-top:var(--s5);border-top:1px solid #e2c58930;opacity:.8}
.hm-pf-card{display:flex;flex-direction:column;align-items:center;gap:var(--s3);padding:var(--s5) var(--s4);border:1px solid var(--line);border-radius:14px;background:#ffffff08}
.hm-pf-title{font:700 22px/1.3 'Taviraj',Georgia,serif;color:#fff4dc;text-align:center}
.hm-pf-level{display:flex;align-items:center;gap:var(--s2);width:100%}
.hm-pf-level .hm-pf-bar{height:8px;border-radius:4px}
.hm-pf-level small{flex:none;font-size:13px;line-height:1.3;color:var(--text-dim);font-variant-numeric:tabular-nums}
.hm-pf-note{display:flex;align-items:flex-start;gap:var(--s3);font-size:14px;color:var(--text-dim)}
.hm-pf-note .hm-ico{margin-top:2px;color:var(--gold-1)}

/* ---------- wide desktop windows: the narrow sheets get a little more room ---------- */
@media (min-width:1100px) and (min-height:600px){
  :where(body:not(.xr-staged)) .hm-sheet.narrow{width:min(420px,calc(40*var(--xvw,1vw)))}
}
/* the same on the fixed 1920x1080 stage, where the window size does not count */
  :where(body.xr-staged) .hm-sheet.narrow{width:min(420px,calc(40*var(--xvw,1vw)))}

/* ---------- large screens: the same layout, a step larger ---------- */
@media (min-width:1600px) and (min-height:900px){
  :where(body:not(.xr-staged)) .home{--edge-y:var(--s5);--edge-x:var(--s7);font-size:16px}
  :where(body:not(.xr-staged)) .hm-avatar{width:56px;height:56px}:where(body:not(.xr-staged)) .hm-profile{min-height:64px}
  :where(body:not(.xr-staged)) .hm-pf-name{font-size:18px}:where(body:not(.xr-staged)) .hm-pf-lv{font-size:14px}:where(body:not(.xr-staged)) .hm-pf-bar{width:132px;height:7px}
  :where(body:not(.xr-staged)) .hm-coin{height:46px}:where(body:not(.xr-staged)) .hm-coin b{font-size:18px}:where(body:not(.xr-staged)) .hm-plus{width:34px;height:34px;border-radius:17px}
  :where(body:not(.xr-staged)) .hm-round{width:54px;height:54px}
  :where(body:not(.xr-staged)) .hm-side{top:calc(var(--edge-y) + 64px + var(--s6));width:380px}
  :where(body:not(.xr-staged)) .hm-banner{min-height:132px}:where(body:not(.xr-staged)) .hm-banner strong{font-size:26px}
  :where(body:not(.xr-staged)) .hm-tile{width:96px;height:88px}:where(body:not(.xr-staged)) .hm-tile span:not(.hm-ico){font-size:15px}:where(body:not(.xr-staged)) .hm-tile .hm-ico{font-size:34px}
  :where(body:not(.xr-staged)) .hm-battle{width:360px;height:112px;--cut:24px}:where(body:not(.xr-staged)) .hm-battle strong{font-size:38px}:where(body:not(.xr-staged)) .hm-battle small{font-size:15px}:where(body:not(.xr-staged)) .hm-battle .hm-ico{font-size:36px}
  :where(body:not(.xr-staged)) .hm-sheet.wide{width:min(1100px,calc(70*var(--xvw,1vw)))}
}
/* the same on the fixed 1920x1080 stage, where the window size does not count */
:where(body.xr-staged) .home{--edge-y:var(--s5);--edge-x:var(--s7);font-size:16px}
  :where(body.xr-staged) .hm-avatar{width:56px;height:56px}:where(body.xr-staged) .hm-profile{min-height:64px}
  :where(body.xr-staged) .hm-pf-name{font-size:18px}:where(body.xr-staged) .hm-pf-lv{font-size:14px}:where(body.xr-staged) .hm-pf-bar{width:132px;height:7px}
  :where(body.xr-staged) .hm-coin{height:46px}:where(body.xr-staged) .hm-coin b{font-size:18px}:where(body.xr-staged) .hm-plus{width:34px;height:34px;border-radius:17px}
  :where(body.xr-staged) .hm-round{width:54px;height:54px}
  :where(body.xr-staged) .hm-side{top:calc(var(--edge-y) + 64px + var(--s6));width:380px}
  :where(body.xr-staged) .hm-banner{min-height:132px}:where(body.xr-staged) .hm-banner strong{font-size:26px}
  :where(body.xr-staged) .hm-tile{width:96px;height:88px}:where(body.xr-staged) .hm-tile span:not(.hm-ico){font-size:15px}:where(body.xr-staged) .hm-tile .hm-ico{font-size:34px}
  :where(body.xr-staged) .hm-battle{width:360px;height:112px;--cut:24px}:where(body.xr-staged) .hm-battle strong{font-size:38px}:where(body.xr-staged) .hm-battle small{font-size:15px}:where(body.xr-staged) .hm-battle .hm-ico{font-size:36px}
  :where(body.xr-staged) .hm-sheet.wide{width:min(1100px,calc(70*var(--xvw,1vw)))}

/* ---------- phones in landscape (about 390 px tall) ---------- */
@media (max-height:500px){
  :where(body:not(.xr-staged)) .home{--edge-y:var(--s3);--edge-x:max(var(--s4),env(safe-area-inset-left),env(safe-area-inset-right));font-size:14px}
  :where(body:not(.xr-staged)) .hm-profile{min-height:44px;gap:var(--s2);padding-right:var(--s3)}
  :where(body:not(.xr-staged)) .hm-avatar{width:36px;height:36px;box-shadow:0 0 0 1.5px var(--gold-2),0 0 0 3px #0b141e}
  :where(body:not(.xr-staged)) .hm-pf-name{font-size:14px;max-width:11ch}:where(body:not(.xr-staged)) .hm-pf-lv{font-size:12px}:where(body:not(.xr-staged)) .hm-pf-bar{width:80px;min-width:56px}
  :where(body:not(.xr-staged)) .hm-coin{height:36px}:where(body:not(.xr-staged)) .hm-plus{width:26px;height:26px;border-radius:13px;font-size:14px}
  :where(body:not(.xr-staged)) .hm-round{width:44px;height:44px}
  :where(body:not(.xr-staged)) .hm-leader{height:calc(86*var(--xvh,1vh));left:clamp(0px,calc(6*var(--xvw,1vw)),64px)}
  :where(body:not(.xr-staged)) .hm-side{top:calc(var(--edge-y) + 44px + var(--s4));width:clamp(200px,calc(30*var(--xvw,1vw)),260px);gap:var(--s2)}
  :where(body:not(.xr-staged)) .hm-banner{min-height:84px;padding:var(--s3) 96px var(--s2) var(--s3)}
  :where(body:not(.xr-staged)) .hm-banner strong{font-size:18px}
  :where(body:not(.xr-staged)) .hm-dock{padding:var(--s1);border-radius:14px;gap:var(--s1)}
  :where(body:not(.xr-staged)) .hm-tile{width:60px;height:56px}
  :where(body:not(.xr-staged)) .hm-tile span:not(.hm-ico){font-size:12px}
  :where(body:not(.xr-staged)) .hm-tile .hm-ico{font-size:22px}
  :where(body:not(.xr-staged)) .hm-battle{width:clamp(180px,calc(26*var(--xvw,1vw)),220px);height:64px;--cut:14px}
  :where(body:not(.xr-staged)) .hm-battle strong{font-size:24px}:where(body:not(.xr-staged)) .hm-battle small{font-size:12px}:where(body:not(.xr-staged)) .hm-battle .hm-ico{font-size:24px}
  :where(body:not(.xr-staged)) .hm-sheet{gap:var(--s3);padding-bottom:var(--s3)}
  :where(body:not(.xr-staged)) .hm-sheet-head{min-height:44px}:where(body:not(.xr-staged)) .hm-sheet-head h2{font-size:19px}
}
/* a short-and-narrow phone: the dock keeps the four tiles that matter */
@media (max-height:500px) and (max-width:700px){
  :where(body:not(.xr-staged)) .hm-tile:nth-child(5){display:none}
  :where(body:not(.xr-staged)) .hm-banner{padding-right:var(--s3);background:linear-gradient(100deg,#0b1622f2,#0b1622cc)}
}

/* ---------- narrow desktop window (fine pointer, portrait): plain stacking, no overlap ----------
   Touch phones never get here (they see the rotate gate), so this only has to be tidy, not pretty. */
@media (max-width:760px) and (min-height:501px){
  :where(body:not(.xr-staged)) .home{--edge-x:var(--s4)}
  :where(body:not(.xr-staged)) .hm-top{gap:var(--s2)}
  :where(body:not(.xr-staged)) .hm-profile{flex:1 1 0;min-width:0}
  :where(body:not(.xr-staged)) .hm-pf-bar{min-width:40px;width:auto}
  :where(body:not(.xr-staged)) .hm-coin b{min-width:0}
  :where(body:not(.xr-staged)) .hm-side{left:var(--edge-x);right:var(--edge-x);width:auto;top:calc(var(--edge-y) + var(--tap) + var(--s4))}
  :where(body:not(.xr-staged)) .hm-banner{min-height:88px}
  :where(body:not(.xr-staged)) .hm-leader{left:50%;transform:translateX(-50%);height:min(calc(58*var(--xvh,1vh)),640px);bottom:calc(var(--edge-y) + 68px + 88px)}
  :where(body:not(.xr-staged)) .hm-dock{left:var(--edge-x);right:var(--edge-x);justify-content:space-between}
  :where(body:not(.xr-staged)) .hm-tile{flex:1 1 0;width:auto;min-width:0}
  :where(body:not(.xr-staged)) .hm-tile:nth-child(4){margin-right:0}:where(body:not(.xr-staged)) .hm-tile:nth-child(4)::after{display:none}
  :where(body:not(.xr-staged)) .hm-tile.soon::before{right:calc(50% - 20px)}
  :where(body:not(.xr-staged)) .hm-battle{left:var(--edge-x);right:var(--edge-x);width:auto;bottom:calc(var(--edge-y) + 68px + var(--s4));height:72px}
  :where(body:not(.xr-staged)) .hm-sheet,:where(body:not(.xr-staged)) .hm-sheet.wide,:where(body:not(.xr-staged)) .hm-sheet.narrow{width:calc(100*var(--xvw,1vw));border-left:0}
  :where(body:not(.xr-staged)) .hm-sheet{padding-left:var(--s4);padding-right:var(--s4)}
}

/* ---------- settings / rules / changelog modals: same spacing scale and Thai type rules as Home ----------
   (the modal sits outside .home, so the 4/8/12/16/24/32 steps are written out) */
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal){padding:24px 32px 32px;font-family:'Kanit','Leelawadee UI',Tahoma,sans-serif;word-break:keep-all;overflow-wrap:anywhere}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-header{display:flex;flex-direction:column;gap:8px;margin-bottom:24px;padding-right:56px}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-header h2{margin:0;padding:0;font:700 24px/1.5 'Taviraj',Georgia,serif;color:#fff4dc}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-header p{margin:0;font-size:14px;line-height:1.55;color:#cfc8b6}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .patch-label{display:flex;align-items:center;gap:8px;font:600 12px/1.3 'Kanit',sans-serif;letter-spacing:.12em;color:#d4b377}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .patch-label svg{width:16px;height:16px}
.arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-close{display:grid;place-items:center;width:44px;height:44px;top:12px;right:12px;font-size:20px;border-radius:50%}
.modal-close svg{width:1em;height:1em}
.settings-modal .leader-frame-settings{margin:0 0 16px;padding:12px 16px 16px}
.settings-modal .leader-frame-settings legend{font-size:14px;line-height:1.3}
.settings-modal .leader-frame-option{min-height:48px;font-size:15px;line-height:1.3}
.settings-modal .settings-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:16px;padding:16px 0}
.settings-modal .set-ico{display:grid;place-items:center;font-size:24px;line-height:1;color:#e2c07a}
.settings-modal .set-ico svg{width:1em;height:1em}
.settings-modal .settings-row strong{font-size:16px;line-height:1.3}
.settings-modal .settings-row p{margin:4px 0 0;font-size:14px;line-height:1.55;color:#cfc8b6}
.settings-modal .toggle{position:relative}
.settings-modal .toggle::after{content:'';position:absolute;inset:-7px -4px}
.settings-modal .rule-note{margin:16px 0 0;font-size:13px;line-height:1.6}
.rules-modal .rules-tabs{margin-bottom:16px}
.rules-modal .rule-sections :is(p,li,td,th){line-height:1.6}
.rules-modal .rule-note{font-size:13px;line-height:1.6}
.changelog-modal .patch-notes{gap:12px}
.changelog-modal .patch-notes section{padding:16px}
.changelog-modal .patch-notes h3{margin:0 0 8px;font-size:17px;line-height:1.3}
.changelog-modal .patch-notes li{padding:2px 0;font-size:15px;line-height:1.6}
@media (max-height:500px){
  :where(body:not(.xr-staged)) .arena-layout :is(.settings-modal,.rules-modal,.changelog-modal){padding:16px 24px 24px}
  :where(body:not(.xr-staged)) .arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-header{margin-bottom:16px}
  :where(body:not(.xr-staged)) .arena-layout :is(.settings-modal,.rules-modal,.changelog-modal) .modal-header h2{font-size:21px}
  :where(body:not(.xr-staged)) .settings-modal .settings-row{padding:12px 0}
}

/* Current MC artwork replaces both retired leader choices. */
.home .hm-leaders{grid-template-columns:1fr}
.hm-standee{background-size:auto 115%;background-position:50% 0}
.leader-pick-thumb>span{background-size:auto 230%;background-position:50% 5%}

/* Account controls share the existing profile sheet and its scroll/focus behavior. */
.hm-auth{display:grid;gap:12px;padding-bottom:16px}
.hm-auth-providers,.hm-auth-name,.hm-auth-confirm{display:grid;gap:10px}
.hm-auth [hidden]{display:none!important}
.hm-auth-note,.hm-auth-message,.hm-auth-confirm p{margin:0;font-size:14px;line-height:1.65;color:#d3cbbd;overflow-wrap:anywhere}
.hm-auth-message{color:#ffe0a2;min-height:0}
.hm-auth-message:empty{display:none}
.hm-auth-button{min-height:46px;padding:10px 16px;border:1px solid #c5a46b;border-radius:10px;background:linear-gradient(135deg,#36414b,#17232d);color:#fff4dc;font:500 15px/1.5 'Kanit','Leelawadee UI',sans-serif;cursor:pointer}
.hm-auth-button:hover:not(:disabled){background:#344656;border-color:#ffe0a2}
.hm-auth-button:disabled{opacity:.48;cursor:default}
.hm-auth-button.secondary{background:#101b25;border-color:#60707d;color:#ddd8cb}
.hm-auth-button.danger{border-color:#d08b82;color:#ffd1ca;background:#482b2b}
.hm-auth-name label{font-size:15px;color:#fff4dc}
.hm-auth-name small{font-size:12px;color:#c4bcac}
.hm-auth-name-row{display:flex;gap:8px;min-width:0}
.hm-auth-name input{width:0;flex:1;min-width:0;border:1px solid #60707d;border-radius:10px;padding:10px 12px;background:#0a141d;color:#fff4dc;font:inherit}
.hm-auth :is(button,input):focus-visible{outline:2px solid #ffe0a2;outline-offset:3px}
.hm-auth-confirm{padding:14px;border:1px solid #b98074;border-radius:10px;background:#2b2024}
#home-sheet-profile .hm-pf-card{flex-shrink:0}
#auth-status{letter-spacing:0;white-space:normal;text-align:right}

/* Keep the painted bevel and its solid backing behind the Home controls. */
.home :is(.hm-dock, .hm-battle) {
  isolation: isolate;
  background: none;
}
.home :is(.hm-dock, .hm-battle)::before,
.home :is(.hm-dock, .hm-battle)::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.home :is(.hm-dock, .hm-battle)::before {
  z-index: -2;
  background: var(--home-frame-ink);
  clip-path: polygon(
    var(--home-frame-cut) 4%, calc(100% - var(--home-frame-cut)) 4%, 99% 42%, 99% 58%,
    calc(100% - var(--home-frame-cut)) 94%, var(--home-frame-cut) 94%, 1% 58%, 1% 42%
  );
}
.home :is(.hm-dock, .hm-battle)::after {
  z-index: -1;
  background: var(--home-frame-art) center / 100% 100% no-repeat;
}
.home .hm-dock {
  --home-frame-art: url('assets/observatory-ui/menu-dock.webp');
  --home-frame-ink: #112237;
  --home-frame-cut: 6%;
  border: 0;
  border-radius: 0;
  gap: clamp(5px, calc(.62*var(--xvw,1vw)), 10px);
  padding: clamp(12px, calc(1.5*var(--xvh,1vh)), 16px) clamp(52px, calc(4.2*var(--xvw,1vw)), 66px);
  box-shadow: none;
  backdrop-filter: none;
}
.home .hm-battle {
  --home-frame-art: url('assets/observatory-ui/enter-arena.webp');
  --home-frame-ink: #9c6b37;
  --home-frame-cut: 9%;
  clip-path: none;
  padding-inline: 0;
}
.hm-battle .hm-battle-main, .hm-battle small { margin-inline: 25% 11%; }
.hm-battle-main .hm-ico { display: none; }
.home .hm-battle:hover { filter: brightness(1.08); }
.home .hm-battle:active { filter: brightness(.91); }
@media (max-height: 500px) {
  :where(body:not(.xr-staged)) .home .hm-dock { padding-inline: clamp(32px, calc(4.55*var(--xvw,1vw)), 48px); }
}
@media (max-height: 500px) and (max-width: 560px) {
  :where(body:not(.xr-staged)) .home .hm-dock .hm-tile { width: 54px; }
}
@media (forced-colors: active) {
  .home :is(.hm-dock, .hm-battle) {
    border: 1px solid ButtonText;
    border-radius: 10px;
    background: ButtonFace;
  }
  .home :is(.hm-dock, .hm-battle)::before,
  .home :is(.hm-dock, .hm-battle)::after { display: none; }
  .home .hm-battle:focus-visible { outline: 2px solid Highlight; }
}

.home .hm-chip {
  border: 0;
  border-radius: 0;
  background: url('assets/observatory-ui/menu-action.webp') center / 100% 100% no-repeat;
  padding-inline: 1.25em;
  color: #fff2d4;
}
.home button.hm-chip:hover { filter: brightness(1.12); }
.home button.hm-chip:active { filter: brightness(.9); }

/* ---- Sonnet pass: dock badges (src/home.ts markDock/syncDockBadges) ---- */
.hm-tile.soon::before { content: none; }
.hm-tile.soon { opacity: .62; }
.hm-tile.soon:hover { opacity: .85; }
.hm-tile .hm-lock { position: absolute; top: 5px; right: 12px; display: grid; place-items: center; width: 16px; height: 16px; font-size: 13px; color: #b9b19c; }
.hm-tile .hm-lock svg { width: 1em; height: 1em; }
.hm-tile .hm-reward { position: absolute; top: 5px; right: 14px; width: 13px; height: 13px; border-radius: 50%; background: var(--danger, #d8423a); box-shadow: 0 0 0 2px #0a121b, 0 0 10px #d8423a99; animation: hm-reward-pulse 2.2s ease-in-out infinite; }
@keyframes hm-reward-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .hm-tile .hm-reward { animation: none; } }

/* ---------- full-screen pages (owner's layout, 28 Nov 2026: mode page and bot setup) ----------
   They are the same "sheets" as before (one at a time, back returns to where it came from), but cover the screen. */
.home .hm-sheet.page{left:0;width:auto;gap:var(--s5);padding:var(--edge-y) var(--edge-x);border:0;box-shadow:none;animation:hm-page-in .2s ease-out;
  background:linear-gradient(180deg,#08111af2 0,#08111acc 30%,#08111ae6 100%),url('assets/river-observatory.webp') center/cover,#08111a}
@keyframes hm-page-in{from{opacity:0;transform:translateY(8px)}}
@media (prefers-reduced-motion:reduce){.home .hm-sheet.page{animation:none}}
.page>.hm-sheet-head{flex:none}
.page>.hm-sheet-head h2{font-size:26px}
.hm-page-wallet{display:flex;gap:var(--s2);margin-left:auto}
.hm-page-wallet>span{display:flex;align-items:center;gap:var(--s2);height:40px;padding:0 var(--s4) 0 var(--s3);border:1px solid var(--line);border-radius:20px;background:var(--ink)}
.hm-page-wallet b{font:700 16px/1 'Kanit',sans-serif;font-variant-numeric:tabular-nums}
.hm-page-home{margin-left:auto;min-height:44px;padding:0 var(--s4);border:1px solid var(--line);border-radius:10px;background:var(--ink)}
.hm-page-home:hover{border-color:var(--line-hi)}

/* ----- mode page: resume + deck on top, then bot (large) · friend · tutorial over ranked ----- */
.hm-mode-grid{flex:1 0 auto;display:grid;width:100%;max-width:1560px;margin:0 auto;gap:var(--s4);
  grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto minmax(150px,1.8fr) minmax(110px,1fr);
  grid-template-areas:'resume resume deck' 'main friend tutorial' 'main friend ranked'}
.hm-mode-grid:not(.has-resume){grid-template-areas:'deck deck deck' 'main friend tutorial' 'main friend ranked'}
.hm-resume-slot{grid-area:resume;display:flex;flex-wrap:wrap;gap:var(--s3);min-width:0}
.hm-resume-slot>*{flex:1 1 260px}
.hm-mode-grid:not(.has-resume) .hm-resume-slot{display:none}
.hm-resume-slot .hm-resume{min-height:72px;border-color:var(--gold-2);background:#2a1c08b3}
.hm-resume-slot .hm-resume p{font-size:15px;color:var(--text)}
.hm-resume-slot .hm-room{min-height:72px;border-color:var(--gold-2)}
.hm-loadout{grid-area:deck;display:flex;align-items:center;gap:var(--s3);width:100%;min-height:72px;padding:var(--s2) var(--s4) var(--s2) var(--s2);text-align:left;border:1px solid var(--line);border-radius:12px;background:var(--ink)}
.hm-loadout:hover{border-color:var(--line-hi)}
.hm-loadout-art{flex:none;width:56px;height:56px;border-radius:10px;overflow:hidden;background:#000}
.hm-loadout-art i{display:block;width:100%;height:100%;background:center 18%/cover no-repeat}
.hm-loadout-copy{display:flex;flex-direction:column;min-width:0}
.hm-loadout-copy small{font-size:12px;line-height:1.3;color:var(--text-faint)}
.hm-loadout-copy strong{font-size:18px;line-height:1.35}
.hm-loadout-go{margin-left:auto;font-size:14px;color:var(--gold-1)}

.hm-mode{position:relative;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;gap:var(--s1);min-width:0;padding:var(--s5);text-align:left;overflow:hidden;
  border:1px solid var(--line);border-radius:16px;background:linear-gradient(170deg,#16283acc,#0a131df2);box-shadow:0 12px 30px #0008}
button.hm-mode:hover{border-color:var(--line-hi);filter:brightness(1.1)}
.hm-mode-ico{margin-bottom:auto;font-size:44px;color:var(--gold-1)}
.hm-mode strong{font:700 24px/1.35 'Taviraj',Georgia,serif;color:#fff4dc}
.hm-mode small{font-size:14px;line-height:1.5;color:var(--text-dim)}
.hm-mode.main{grid-area:main;border-color:var(--gold-2);
  background:linear-gradient(180deg,#1a140b00 38%,#1a140bd9 72%,#1a140bfa),var(--hero-art,none) center 20%/cover no-repeat,#1a140b}
.hm-mode.main .hm-mode-ico{display:grid;width:64px;height:64px;border-radius:50%;background:#140d04d9;font-size:36px}
.hm-mode.main strong{font-size:32px;color:#fff1cf}
.hm-mode.main small{color:#e3d7bd}
.hm-mode.friend{grid-area:friend}
/* cards without a picture carry a large faint emblem in the middle */
.hm-mode:not(.main) .hm-mode-ico{position:absolute;top:42%;left:50%;margin:0;font-size:clamp(72px,calc(16*var(--xvh,1vh)),160px);opacity:.2;transform:translate(-50%,-50%);pointer-events:none}
.hm-mode-row{display:flex;flex-wrap:wrap;gap:var(--s3);padding-top:var(--s4)}
.hm-mode .hm-chip{display:inline-flex;align-items:center}
.hm-mode.tutorial{grid-area:tutorial}
.hm-mode.locked{grid-area:ranked;opacity:.6}
.hm-mode-lock{position:absolute;top:var(--s5);right:var(--s5);font-size:22px;color:var(--text-dim)}

/* ----- bot setup: our seat · level · the bot's seat, and the start bar ----- */
.hm-versus{flex:1 0 auto;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr) minmax(0,1.25fr);grid-template-rows:minmax(300px,1fr);gap:var(--s4);width:100%;max-width:1560px;margin:0 auto}
.hm-seat,.hm-level{display:flex;flex-direction:column;gap:var(--s3);min-width:0;min-height:0;padding:var(--s4);border:1px solid var(--line);border-radius:16px;background:var(--ink)}
.hm-versus h3{margin:0;font:600 15px/1.4 'Kanit',sans-serif;color:var(--gold-1)}
.hm-seat-show{flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--s2);container-type:size}
.hm-seat-card{flex:none;width:min(100cqw,calc((100cqh - 84px) * 2 / 3),340px)}
.hm-seat-unknown{display:grid;place-items:center;width:100%;aspect-ratio:2/3;border:2px dashed var(--line-hi);border-radius:12px;font:700 64px/1 'Taviraj',Georgia,serif;color:var(--gold-1)}
.hm-seat-copy{flex:none;display:flex;flex-direction:column;align-items:center}
.hm-seat-copy strong{font:700 20px/1.4 'Taviraj',Georgia,serif;color:#fff4dc;text-align:center}
.hm-seat-copy .hm-link{margin:0;padding:var(--s1) var(--s2)}
.hm-picks{flex:none;display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:var(--s2)}
/* the bot's strip: the five colours, then "random" and "same as ours" on their own row */
.foe .hm-picks{grid-template-columns:repeat(10,minmax(0,1fr))}
.foe .hm-pick{grid-column:span 2}
.foe .hm-pick:is([data-deck="random"],[data-deck="mirror"]){grid-column:span 5;flex-direction:row;justify-content:center;gap:var(--s2);min-height:44px;padding-block:var(--s1)}
.hm-pick{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:2px;min-width:0;min-height:64px;padding:var(--s2) 2px;border:1px solid var(--line);border-radius:10px;background:#ffffff08}
.hm-pick:hover{border-color:var(--line-hi)}
.hm-pick[aria-pressed="true"]{border-color:var(--gold-2);background:#e2b05326;box-shadow:inset 0 0 0 1px var(--gold-2)}
.hm-pick-mark{display:grid;place-items:center;height:30px;font-size:28px;line-height:1;color:var(--element,var(--gold-1))}
.hm-pick-mark svg{display:block;width:1em;height:1em}
.hm-pick-name{font-size:12px;line-height:1.35;text-align:center;word-break:keep-all;overflow-wrap:normal}
.home .botroom .hm-bot-level{display:flex;flex-direction:column;flex-wrap:nowrap;align-items:stretch;gap:var(--s2);flex:1;justify-content:center;margin:0}
.home .botroom .hm-bot-level button{flex:1;min-height:44px;max-height:72px;border-radius:12px;font-size:17px}
.hm-fast{flex:none;display:flex;align-items:center;justify-content:space-between;gap:var(--s3);min-height:56px;padding:var(--s2) var(--s3);text-align:left;border:1px solid var(--line);border-radius:12px;background:#ffffff08;font-size:15px}
.hm-fast small{display:block;font-size:12px;line-height:1.45;color:var(--text-faint)}
.hm-fast i{position:relative;flex:none;width:44px;height:24px;border-radius:12px;background:#ffffff2b}
.hm-fast i::after{content:'';position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff4dc;transition:transform .15s}
.hm-fast[aria-checked="true"] i{background:var(--gold-2)}
.hm-fast[aria-checked="true"] i::after{transform:translateX(20px)}
.hm-versus-foot{flex:none;display:flex;align-items:center;justify-content:space-between;gap:var(--s5);width:100%;max-width:1560px;margin:0 auto;padding:var(--s3) var(--s3) var(--s3) var(--s5);border:1px solid var(--line);border-radius:16px;background:var(--ink)}
.hm-versus-foot p{display:flex;flex-direction:column;min-width:0;margin:0;font-size:17px;line-height:1.45}
.hm-versus-foot small{font-size:13px;color:var(--text-faint)}
.hm-start{flex:none;min-width:280px;min-height:64px;padding:0 var(--s6);border:0;border-radius:12px;background:var(--gold-fill);font:800 24px/1.3 'Taviraj',Georgia,serif;color:var(--on-gold)}
.home .hm-start{color:var(--on-gold)}
.hm-start:hover{background:var(--gold-fill-hover)}

/* smaller desktop windows */
@media (max-width:1279px){
  :where(body:not(.xr-staged)) .hm-versus{grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr) minmax(0,1.2fr)}
  :where(body:not(.xr-staged)) .hm-pick-name{font-size:11px}
}
/* phones in landscape */
@media (max-height:500px){
  :where(body:not(.xr-staged)) .home .hm-sheet.page{gap:var(--s2)}
  :where(body:not(.xr-staged)) .page>.hm-sheet-head h2{font-size:19px}
  :where(body:not(.xr-staged)) .hm-page-wallet>span{height:32px}
  :where(body:not(.xr-staged)) .hm-mode-grid{flex:1 1 0;min-height:0;gap:var(--s2);grid-template-rows:auto minmax(0,1.5fr) minmax(0,1fr)}
  :where(body:not(.xr-staged)) .hm-loadout,:where(body:not(.xr-staged)) .hm-resume-slot .hm-resume,:where(body:not(.xr-staged)) .hm-resume-slot .hm-room{min-height:48px;padding-block:var(--s1)}
  :where(body:not(.xr-staged)) .hm-resume-slot .hm-resume p{font-size:12px}
  :where(body:not(.xr-staged)) .hm-loadout-art{width:38px;height:38px}
  :where(body:not(.xr-staged)) .hm-loadout-copy strong{font-size:14px}
  :where(body:not(.xr-staged)) .hm-mode{gap:0;padding:var(--s2) var(--s3)}
  :where(body:not(.xr-staged)) .hm-mode-ico,:where(body:not(.xr-staged)) .hm-mode:not(.main) .hm-mode-ico,:where(body:not(.xr-staged)) .hm-mode.main .hm-mode-ico{position:absolute;top:var(--s2);right:var(--s2);left:auto;width:auto;height:auto;margin:0;background:none;font-size:24px;opacity:.7;transform:none}
  :where(body:not(.xr-staged)) .hm-mode strong,:where(body:not(.xr-staged)) .hm-mode.main strong{font-size:17px}
  :where(body:not(.xr-staged)) .hm-mode small{font-size:12px}
  :where(body:not(.xr-staged)) .hm-mode-row{gap:var(--s2);padding-top:var(--s2)}
  :where(body:not(.xr-staged)) .hm-mode-lock{top:var(--s2);right:var(--s6);font-size:18px}
  :where(body:not(.xr-staged)) .hm-versus{flex:1 1 0;min-height:0;grid-template-rows:minmax(0,1fr);gap:var(--s2)}
  :where(body:not(.xr-staged)) .hm-seat,:where(body:not(.xr-staged)) .hm-level{gap:var(--s1);padding:var(--s2);overflow-y:auto}
  :where(body:not(.xr-staged)) .hm-seat-show{flex-direction:row;min-height:56px}
  :where(body:not(.xr-staged)) .hm-seat-card{width:min(104px,calc(100cqh * 2 / 3))}
  :where(body:not(.xr-staged)) .hm-seat-unknown{font-size:28px}
  :where(body:not(.xr-staged)) .hm-seat-copy strong{font-size:14px}
  :where(body:not(.xr-staged)) .hm-picks{gap:var(--s1)}
  :where(body:not(.xr-staged)) .foe .hm-pick:is([data-deck="random"],[data-deck="mirror"]){min-height:32px}
  :where(body:not(.xr-staged)) .hm-pick{min-height:44px;padding:2px}
  :where(body:not(.xr-staged)) .hm-pick-mark{height:20px;font-size:18px}
  :where(body:not(.xr-staged)) .hm-pick-name{font-size:10px}
  :where(body:not(.xr-staged)) .home .botroom .hm-bot-level{gap:var(--s1);flex:none}
  :where(body:not(.xr-staged)) .home .botroom .hm-bot-level button{flex:none;min-height:36px;font-size:14px}
  :where(body:not(.xr-staged)) .hm-fast{min-height:36px;padding:var(--s1) var(--s2);font-size:13px}
  :where(body:not(.xr-staged)) .hm-fast small{display:none}
  :where(body:not(.xr-staged)) .hm-versus-foot{padding:var(--s1) var(--s1) var(--s1) var(--s3)}
  :where(body:not(.xr-staged)) .hm-versus-foot p{font-size:14px}
  :where(body:not(.xr-staged)) .hm-versus-foot small{display:none}
  :where(body:not(.xr-staged)) .hm-start{min-width:180px;min-height:44px;font-size:18px}
}
/* narrow desktop window (fine pointer, portrait): one column that scrolls */
@media (max-width:760px) and (min-height:501px){
  :where(body:not(.xr-staged)) .home .hm-sheet.page{width:auto;padding-inline:var(--s4)}
  :where(body:not(.xr-staged)) .hm-mode-grid,:where(body:not(.xr-staged)) .hm-mode-grid:not(.has-resume){flex:none;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:minmax(120px,auto)}
  :where(body:not(.xr-staged)) .hm-mode-grid{grid-template-areas:'resume' 'deck' 'main' 'friend' 'tutorial' 'ranked'}
  :where(body:not(.xr-staged)) .hm-mode-grid:not(.has-resume){grid-template-areas:'deck' 'main' 'friend' 'tutorial' 'ranked'}
  :where(body:not(.xr-staged)) .hm-loadout,:where(body:not(.xr-staged)) .hm-resume-slot{grid-auto-rows:auto}
  :where(body:not(.xr-staged)) .hm-mode.main{min-height:220px}
  :where(body:not(.xr-staged)) .hm-versus{flex:none;grid-template-columns:minmax(0,1fr);grid-template-rows:none}
  :where(body:not(.xr-staged)) .hm-seat-show{flex:none;height:320px}
  :where(body:not(.xr-staged)) .hm-versus-foot{flex-direction:column;align-items:stretch;gap:var(--s2);text-align:center}
  :where(body:not(.xr-staged)) .hm-page-wallet{display:none}
}

/* ----- deck list page: the chosen deck large on top, every deck in a strip below ----- */
.deckpage .hm-sheet-note{margin-left:var(--s2)}
.hm-deck-body{flex:1 0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:minmax(340px,1fr);gap:var(--s7);width:100%;max-width:1200px;margin:0 auto}
.hm-deck-frame{display:flex;align-items:center;justify-content:flex-end;min-width:0;min-height:0;container-type:size}
.hm-deck-card{flex:none;width:min(100cqw,calc(100cqh * 2 / 3),420px)}
.hm-deck-card .card-frame,.hm-deck-card svg{width:100%;height:auto;display:block}
.hm-deck-info{display:flex;flex-direction:column;justify-content:center;gap:var(--s4);min-width:0;max-width:520px}
.hm-deck-copy{display:flex;flex-direction:column;align-items:flex-start}
.hm-deck-tag{font-size:13px;line-height:1.3;color:var(--gold-1)}
.hm-deck-name{margin-top:var(--s1);font:700 28px/1.35 'Taviraj',Georgia,serif;color:#fff4dc}
.hm-deck-desc{margin:var(--s2) 0 0;font-size:15px;line-height:1.6;color:#e7dfcc}
.hm-deck-rule{margin:var(--s1) 0 0;font-size:13px;line-height:1.4;color:var(--text-faint)}
.hm-curve-block{display:flex;flex-direction:column;gap:var(--s2)}
.hm-curve-block .hm-label{letter-spacing:0}
.hm-curve{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:var(--s2);padding:var(--s3);border:1px solid var(--line);border-radius:12px;background:var(--ink)}
.hm-curve-col{display:flex;flex-direction:column;align-items:center;gap:2px;min-width:0}
.hm-curve-col b{font:600 13px/1.3 'Kanit',sans-serif;font-variant-numeric:tabular-nums}
.hm-curve-track{display:flex;align-items:flex-end;width:100%;max-width:36px;height:52px}
.hm-curve-track i{display:block;width:100%;min-height:2px;border-radius:4px 4px 0 0;background:var(--active-element,var(--gold-1))}
.hm-curve-col small{font-size:12px;line-height:1.3;color:var(--text-faint)}
.deckpage .hm-leaders-block{max-width:280px}
.hm-deck-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s3)}
.hm-deck-actions .hm-chip{display:inline-flex;align-items:center;min-height:52px}
.home .hm-use{min-width:200px;min-height:52px;padding:0 var(--s6);border:0;border-radius:12px;background:var(--gold-fill);font:800 20px/1.3 'Taviraj',Georgia,serif;color:var(--on-gold)}
.home .hm-use:hover{background:var(--gold-fill-hover)}
.hm-deck-strip{flex:none;width:100%;max-width:1200px;margin:0 auto}
.home .hm-decks{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:var(--s3);margin:0}
.home .deckpage .hm-decks .start-element{min-height:clamp(96px,calc(17*var(--xvh,1vh)),170px)}
@media (max-height:500px){
  :where(body:not(.xr-staged)) .hm-deck-body{flex:1 1 0;min-height:0;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);grid-template-rows:minmax(0,1fr);gap:var(--s4)}
  :where(body:not(.xr-staged)) .hm-deck-info{justify-content:flex-start;gap:var(--s2);overflow-y:auto}
  :where(body:not(.xr-staged)) .hm-deck-name{font-size:18px}
  :where(body:not(.xr-staged)) .hm-deck-desc{font-size:13px;line-height:1.5}
  :where(body:not(.xr-staged)) .hm-curve{padding:var(--s2)}
  :where(body:not(.xr-staged)) .hm-curve-track{height:28px}
  :where(body:not(.xr-staged)) .hm-deck-actions{order:-1}
  :where(body:not(.xr-staged)) .hm-deck-actions .hm-chip,:where(body:not(.xr-staged)) .home .hm-use{min-height:44px;font-size:15px}
  :where(body:not(.xr-staged)) .home .hm-use{min-width:140px}
  :where(body:not(.xr-staged)) .home .deckpage .hm-decks .start-element{min-height:56px}
}
@media (max-width:760px) and (min-height:501px){
  :where(body:not(.xr-staged)) .hm-deck-body{flex:none;grid-template-columns:minmax(0,1fr);grid-template-rows:none}
  :where(body:not(.xr-staged)) .hm-deck-frame{justify-content:center;height:360px}
  :where(body:not(.xr-staged)) .home .hm-decks{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* patch notes: one fold per version, the newest open */
.changelog-modal .patch-version{border:1px solid #e2c58930;border-radius:12px;background:#ffffff06}
.changelog-modal .patch-version>summary{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;min-height:48px;padding:12px 16px;cursor:pointer;list-style-position:inside}
.changelog-modal .patch-version>summary strong{font:700 18px/1.4 'Taviraj',Georgia,serif;color:#fff4dc}
.changelog-modal .patch-version>summary span{font-size:13px;color:#cfc8b6}
.changelog-modal .patch-version>summary em{flex-basis:100%;font-style:normal;font-size:14px;color:#e2c07a}
.changelog-modal .patch-version>summary:focus-visible{outline:2px solid #ffe7a8;outline-offset:2px}
.changelog-modal .patch-version>section{margin:0 8px 8px}
