/* Tail Crew HUD. Design tokens first; the touch layout overrides live in mobile.css, panel contents in panels.css. */
:root {
  --ink: #0a1128;
  --panel: rgba(13, 21, 44, 0.86);
  --panel-solid: #121c3a;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --line: rgba(170, 195, 255, 0.14);
  --line-2: rgba(170, 195, 255, 0.26);
  --border: #2f4a85;          /* kept for older modules (battle, cosmetics, market) */
  --border-hi: #6fa6ff;
  --text: #f2f5ff;
  --muted: #a3b3d9;
  --accent: #4c8dff;
  --accent-2: #7aa8ff;
  --gold: #ffcf4a;
  --gold-2: #f3a51e;
  --danger: #ff5f6b;
  --ok: #3ee07a;
  --hp: #3ee07a;
  --radius: 14px;
  --r-sm: 10px;
  --shadow: 0 10px 28px rgba(2, 6, 20, 0.45);
  --shadow-sm: 0 3px 10px rgba(2, 6, 20, 0.35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --t: 180ms;
  --focus: 0 0 0 3px rgba(122, 168, 255, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e1630; font-family: Nunito, system-ui, sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; }
#game, #labels { position: fixed; inset: 0; }
#labels { pointer-events: none; z-index: 0; }   /* its own layer: the labels' per-tag z-index (CSS2DRenderer) stays under the HUD and minimap */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
img { image-rendering: auto; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus) !important; }
.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: middle; }
.ic-tile { width: 40px; height: 40px; }
.ic-m3d { overflow: visible; }
.ic-m3d .ic-3d.fresh { animation: ic3d-in 220ms ease-out; transform-origin: 24px 26px; }
@keyframes ic3d-in { from { opacity: 0; transform: scale(.8); } }
.ball3d { width: 100%; height: 100%; display: block; }
.ball3d.xs { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; }
kbd, .kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px;
  background: rgba(255, 255, 255, .92); color: #13204a; font: 900 10.5px/1 Nunito, system-ui, sans-serif; box-shadow: 0 1.5px 0 rgba(0, 0, 0, .35);
}
html.no-keys .kbd, html.touch .kbd, html.no-keys #movebar .key, html.no-keys .hb .key, html.no-keys #ball-btn .key { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
}

/* ---------- name tags ---------- */
.nametag { font-size: 11px; font-weight: 800; text-align: center; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; transform: translateY(-4px); }
.nametag .tag { color: var(--gold); }
/* caught before (js/wilds.js, js/battle/realtime.js, the battle name box): a small Poké Ball by a wild Pokémon's name */
.nt-caught { display: inline-block; position: relative; width: 9px; height: 9px; margin-right: 3px; vertical-align: -1px; border-radius: 50%; font-style: normal;
  background: linear-gradient(#ee3b3b 0 44%, #1b1b1f 44% 56%, #f5f5f5 56%); box-shadow: 0 0 0 1px #1b1b1f, 0 1px 2px rgba(0, 0, 0, .7); }
.nt-caught::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #fff; border: 1px solid #1b1b1f; }
.bt-name .nt-caught { margin: 0 0 0 2px; width: 11px; height: 11px; vertical-align: 0; }
.bt-name .nt-caught::after { width: 3px; height: 3px; }
.nametag .title { font-size: 9px; color: #c8e7ff; font-weight: 600; }
.nametag.me .nm { color: #ffe36e; }
/* other real players: their own colour, so a player never reads like an NPC (owner, 24 Nov 2026); you stay gold */
.nametag.player .nm { color: #7fe6ff; text-shadow: 0 1px 2px #002a3a, 0 0 4px rgba(0, 150, 210, .9); }
/* a title (earned, guild or PvP) as a small badge under the name: tinted by --tc, no brackets */
.nametag .title.ttl { display: flex; width: max-content; align-items: center; gap: 4px; margin: 2px auto 0; padding: 1px 7px 1px 6px; border-radius: 999px;
  font: 900 8.5px/1.35 Nunito, system-ui, sans-serif; letter-spacing: .7px; text-transform: uppercase; color: #fff;
  background: linear-gradient(rgba(16, 26, 58, .88), rgba(8, 14, 34, .88)); border: 1px solid var(--tc, #ffd23f);
  box-shadow: 0 0 6px color-mix(in srgb, var(--tc, #ffd23f) 55%, transparent); text-shadow: 0 1px 1px #000; }
.nametag .title.ttl::before { content: '✦'; color: var(--tc, #ffd23f); font-size: 8px; }
.nametag .title.ttl .gtag { margin-right: 1px; }
.nametag .gtag { display: inline-block; padding: 0 4px; border-radius: 5px; font: 900 9px/1.35 Nunito, system-ui, sans-serif; letter-spacing: .4px;
  color: #13204a; background: var(--tc, #ffd34d); text-shadow: none; vertical-align: 1px; }
/* a game master's tag (js/entities.js label gm): yellow, before the name */
.nametag .gmtag { display: inline-block; padding: 0 5px; border-radius: 5px; font: 900 9.5px/1.4 Nunito, system-ui, sans-serif; letter-spacing: .6px;
  color: #1a1400; background: linear-gradient(#ffe45c, #ffc21a); border: 1px solid #fff2a8; box-shadow: 0 0 6px rgba(255, 205, 40, .7); text-shadow: none; vertical-align: 1px; }
.nametag.wild .nm { color: #ffe9a8; font-size: 10px; }
.nametag.mon .nm { font-size: 10px; }
.bubble {
  background: #fff; color: #1a2340; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 12px;
  max-width: 200px; white-space: normal; text-align: center; box-shadow: 0 3px 8px rgba(0,0,0,.35);
  position: relative; transform: translateY(-6px);
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }
.float-text { position: fixed; transform: translate(-50%, -50%); font-weight: 900; font-size: 16px; text-shadow: 0 2px 3px #000; pointer-events: none; }

/* ---------- quest area (story card + tutorial) ---------- */
/* next to the party (hud.js publishes the party's and the top-right cluster's edges): to the right of the party
   column, or under it when the window is too narrow (html.q-under); it scrolls instead of running into the bottom bar */
#quests {
  position: absolute; z-index: 2; top: 12px; left: calc(var(--party-right, 240px) + 12px);
  width: clamp(240px, calc(var(--tr-left, 900px) - var(--party-right, 240px) - 24px), 340px);
  max-height: max(64px, calc(calc(100 * var(--uvh, 1vh)) - 12px - 190px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  display: flex; flex-direction: column; gap: 8px;
}
html:not(.touch).q-under #quests { left: 12px; top: calc(var(--party-bottom, 120px) + 8px); width: min(320px, calc(var(--tr-left, 400px) - 24px));
  max-height: max(64px, calc(calc(100 * var(--uvh, 1vh)) - var(--party-bottom, 120px) - 8px - 190px)); }
#quests::-webkit-scrollbar { display: none; }
#quests > * { flex: none; }

/* ---------- top right ---------- */
#top-right { position: absolute; top: 12px; right: 12px; display: flex; gap: 10px; align-items: flex-start; }
.top-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; max-width: 230px; }
.tb {
  position: relative; width: 56px; height: 60px; padding: 4px 0 3px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 800; color: var(--muted); box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), border-color var(--t), color var(--t);
}
.tb-ic { width: 34px; height: 34px; display: block; }
.tb-ic .ic-tile { width: 34px; height: 34px; }
.tb:hover { border-color: var(--line-2); color: #fff; transform: translateY(-1px); }
.tb:active { transform: scale(.95); }
.tb[data-badge]:not([data-badge=""])::after, .mtb[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge); position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center;
  background: var(--danger); color: #fff; font: 900 11px/1 Nunito, sans-serif; border-radius: 9px; border: 2px solid var(--ink);
}
/* the top-right keeps only the minimap (+ the ☰ button on touch, the lure timer while one runs) */
.top-buttons:not(:has(> :not(#cos-hud))):not(:has(.cos-lure:not([hidden]))) { display: none; }
#cos-hud:not(:has(.cos-lure:not([hidden]))) { display: none; }

/* ---------- wallet pills (js/hud.js walletHtml): the ☰ menu's wallet row and the panels that spend money ---------- */
.wallet { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; min-width: 0; }
.wl-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px 0 6px; border-radius: 999px; background: rgba(0, 0, 0, .28);
  border: 1px solid var(--line-2); color: var(--gold); font: 900 13px/1 Nunito, sans-serif; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wl-pill .dia { width: 17px; height: 17px; flex: none; }
.wl-dia { color: #9be8ff; }
.wl-cur { outline: 2px solid rgba(255, 246, 200, .55); outline-offset: -5px; display: grid; place-items: center; flex: none; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 11px;
  background: linear-gradient(#ffe07a, #e0a51c); color: #5a3a00; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .2); }
button.wl-pill { cursor: pointer; transition: border-color var(--t), background var(--t); }
button.wl-pill:hover { border-color: #9be8ff; background: rgba(155, 232, 255, .08); }
.wl-plus { display: grid; place-items: center; width: 18px; height: 18px; margin-left: auto; border-radius: 50%; font-style: normal; font-size: 14px; background: var(--gold); color: #13204a; }
.mn-wallet { display: flex; padding: 2px 0 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.mn-wallet .wallet { flex: 1; gap: 8px; justify-content: center; }
.mn-wallet .wl-pill { flex: 1 1 0; max-width: 260px; justify-content: center; min-height: 38px; font-size: 15px; }
.mn-wallet .wl-plus { margin-left: 4px; }
/* The minimap is drawn by WebGL underneath this panel, so the view area must stay see-through */
#minimap { width: 236px; padding: 0; background: transparent; overflow: hidden; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 16px; }
.mm-title { text-align: center; font-weight: 900; font-size: 12px; letter-spacing: .3px; background: var(--panel-solid); padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#minimap-view { height: 150px; }
.mm-footer { display: flex; gap: 6px; align-items: center; font-weight: 800; font-size: 12px; padding: 4px 9px; background: var(--panel-solid); border-top: 1px solid var(--line); color: var(--muted); }
#clock { color: var(--text); font-variant-numeric: tabular-nums; }
#clock-icon svg { width: 15px; height: 15px; display: block; }
#weather { margin-left: auto; }

/* ---------- party ---------- */
#party { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; width: 228px; }
.pm {
  position: relative; display: grid; grid-template-columns: 46px 1fr; gap: 8px; align-items: center; padding: 5px 10px 6px 5px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: border-color var(--t), transform var(--t) var(--ease);
}
.pm:hover { border-color: var(--line-2); }
.pm:active { transform: scale(.98); }
.pm.lead { border-color: rgba(255, 207, 74, .75); box-shadow: 0 0 0 1px rgba(255, 207, 74, .35), var(--shadow-sm); }
.pm.fainted { filter: grayscale(.9) brightness(.8); }
/* press and hold to reorder (js/partydrag.js): the held one sinks a little, then lifts (a ghost under the finger) and
   leaves a dashed gap that moves through the column */
#party .pm { touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
#party .pm.pm-hold { transform: scale(.94); transition: transform .3s var(--ease); }
#party .pm.pm-gap { background: rgba(255, 207, 74, .08); border: 1.5px dashed rgba(255, 207, 74, .7); box-shadow: none; }
#party .pm.pm-gap > * { visibility: hidden; }
#party.dragging .pm:not(.pm-gap) { cursor: grabbing; }
.pm.pm-ghost {
  position: fixed; z-index: 9999; margin: 0; pointer-events: none; cursor: grabbing;
  transform: translateY(-4px) scale(1.16); border-color: rgba(255, 207, 74, .95);
  box-shadow: 0 0 0 3px rgba(255, 207, 74, .5), 0 16px 30px rgba(0, 0, 0, .5);
}
.pm .exp { position: absolute; top: -5px; left: 6px; font-size: 8.5px; font-weight: 900; background: #2c8be8; padding: 1px 5px; border-radius: 6px; letter-spacing: .3px; }
.pm-icon { width: 46px; height: 46px; border-radius: 12px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--t, #4c8dff) 45%, #1a2a58), #121c3a 75%); overflow: hidden; }
.pm-icon img { width: 100%; height: 100%; object-fit: contain; }
.pm-info { min-width: 0; }
.pm-top { display: flex; justify-content: space-between; gap: 6px; font-size: 13px; }
.pm-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-top span { color: var(--gold); font-size: 11.5px; font-weight: 900; white-space: nowrap; }
.shiny { color: #ffd84a; font-style: normal; margin-right: 2px; }
.hp { position: relative; height: 12px; margin-top: 5px; background: rgba(0, 0, 0, .45); border-radius: 7px; overflow: hidden; }
.hp-fill { height: 100%; border-radius: inherit; background: linear-gradient(#7ff7a8, var(--hp)); transition: width .35s var(--ease); }
.hp-fill.mid { background: linear-gradient(#ffe36e, #f0b71c); }
.hp-fill.low { background: linear-gradient(#ff8c8c, #e83b3b); }
.hp span { position: absolute; inset: 0; font-size: 9px; font-weight: 900; text-align: center; line-height: 12px; color: #fff; text-shadow: 0 1px 1px #000; }
.xp { height: 3px; margin-top: 4px; background: rgba(0, 0, 0, .45); border-radius: 2px; overflow: hidden; }
.xp > div { height: 100%; background: #4fc3ff; }

/* ---------- chat: #chat[data-state] = hidden (bubble) · compact (ticker) · expanded (js/chat.js) ---------- */
#chat { position: absolute; z-index: 2; left: 12px; bottom: 12px; width: clamp(250px, calc(calc(50 * var(--uvw, 1vw)) - 252px), 340px); }
#chat[data-state="expanded"] { width: clamp(240px, calc(var(--mb-left, 384px) - 24px), 360px); z-index: 4; }
/* kept focusable (Enter opens the chat by focusing the input) but out of sight and out of the way */
#chat[data-state="hidden"] .chat-card, #chat:not([data-state="expanded"]) #chat-form, #chat:not([data-state="expanded"]) .chat-tabs {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none;
}
.chat-bubble {
  position: relative; display: none; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 50%; color: #fff;
  background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform var(--t) var(--ease), border-color var(--t);
}
.chat-bubble .ic { width: 24px; height: 24px; }
.chat-bubble:hover { border-color: var(--accent-2); transform: translateY(-1px); }
#chat[data-state="hidden"] .chat-bubble { display: grid; }
.chat-unread {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; border: 2px solid var(--ink);
  background: var(--danger); color: #fff; font: 900 10.5px/14px Nunito, sans-serif; font-style: normal; text-align: center;
}
.chat-unread[hidden] { display: none; }
.chat-card { position: relative; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.chat-head { display: flex; align-items: center; gap: 4px; padding: 5px 5px 5px 6px; border-bottom: 1px solid var(--line); }
/* channel pills: one scrollable row, never clipped by the icons */
.chat-tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.chat-tabs::-webkit-scrollbar { display: none; }
.ct {
  flex: none; display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; border-radius: 999px; font-size: 12px; font-weight: 800;
  padding: 5px 9px; color: var(--muted); white-space: nowrap; transition: background var(--t), color var(--t);
}
.ct:hover { color: #fff; }
.ct.active { background: var(--surface-2); color: #fff; }
.ct-n { font: 900 10px/16px Nunito, sans-serif; font-style: normal; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; text-align: center; }
.ct-n[hidden] { display: none; }
.chat-ibtn { width: 30px; height: 30px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 9px; border: 0; background: none; color: var(--muted); transition: background var(--t), color var(--t); }
.chat-ibtn .ic { width: 18px; height: 18px; }
.chat-ibtn:hover { color: #fff; background: var(--surface-2); }
#chat-log { height: clamp(96px, calc(calc(100 * var(--uvh, 1vh)) - 330px), 190px); overflow-y: auto; padding: 6px 10px; font-size: 12.5px; background: rgba(4, 10, 24, .35); overscroll-behavior: contain; }
/* compact: a quiet three-line ticker; the size / hide icons float in its top-right corner */
#chat[data-state="compact"] .chat-card { background: rgba(10, 17, 40, .55); border-color: var(--line); box-shadow: none; }
#chat[data-state="compact"] .chat-head { position: absolute; top: 0; right: 0; z-index: 1; padding: 3px; border: 0; gap: 0; opacity: .7; transition: opacity var(--t); }
#chat[data-state="compact"]:hover .chat-head, #chat[data-state="compact"] .chat-head:focus-within { opacity: 1; }
#chat[data-state="compact"] .chat-ibtn { width: 26px; height: 26px; }
#chat[data-state="compact"] #chat-log { height: auto; min-height: 30px; max-height: calc(3 * 1.35em + 14px); overflow: hidden; padding: 6px 9px; background: none; cursor: pointer; }
#chat[data-state="compact"] .msg:first-child { padding-right: 52px; }   /* clear of the floating icons */
#chat[data-state="compact"] .msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
#chat[data-state="compact"] .msg:last-child { margin-bottom: 0; }
.msg { margin-bottom: 3px; line-height: 1.35; overflow-wrap: anywhere; }
.msg b { font-style: normal; color: #ffe08a; }
.msg.sys { color: #c4d2f2; }
.msg.quiet { color: var(--muted); opacity: .8; }
/* priority colours: someone @mentions you (gold), a staff notice (red-orange); game lines stay muted */
.msg.mention { background: rgba(255, 207, 74, .12); box-shadow: inset 3px 0 #ffcf4a; padding: 2px 6px; border-radius: 6px; }
.msg.notice { background: rgba(255, 99, 72, .14); box-shadow: inset 3px 0 #ff6348; padding: 2px 6px; border-radius: 6px; color: #ffe1db; }
.msg.catch { color: #7dff9f; font-weight: 800; }
.msg.battle { color: #ffc4e6; }
.msg.note { color: #9fe1ff; }
/* expanded log: a name row per sender (grouped), the text under it, a compact time on the right */
#chat[data-state="expanded"] .msg { margin: 0; padding: 3px 4px; border-radius: 6px; }
#chat[data-state="expanded"] .msg.pl:not(.cont) { margin-top: 5px; }
#chat[data-state="expanded"] .msg.sys { display: flex; gap: 8px; align-items: baseline; padding: 3px 4px; }
.m-sys { flex: 1; min-width: 0; }
.m-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.m-head time { margin-left: auto; }
.msg time { flex: none; font-size: 10.5px; color: var(--muted); opacity: .75; font-variant-numeric: tabular-nums; }
.m-name, .m-at, .m-tag { font: inherit; border: 0; padding: 0; background: none; cursor: pointer; }
.m-name { font-weight: 900; color: #ffe08a; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-name.me { color: #9fe1ff; }
.m-name:hover, .m-name:focus-visible { text-decoration: underline; }
/* a game master's line: the same yellow GM tag as on their name tag (.nametag .gmtag), before the name */
.m-staff { font: 900 9px/14px Nunito, sans-serif; padding: 0 5px; border-radius: 5px; color: #1a1400; background: linear-gradient(#ffe45c, #ffc21a);
  border: 1px solid #fff2a8; box-shadow: 0 0 5px rgba(255, 205, 40, .6); letter-spacing: .06em; }
.m-staff.m-staffonly { color: #fff; background: #ff6348; border-color: #ff8a73; box-shadow: none; }
.m-what { color: var(--muted); font-size: 11.5px; }
.m-text { color: #e8eeff; }
/* a guild notice (js/chat.js noticeText): one small muted line, centred, no name or time */
.msg.note { display: flex; justify-content: center; padding: 2px 8px; }
.m-note { font-size: .78em; color: rgba(232, 238, 255, .55); text-align: center; line-height: 1.3; }
.m-note b { color: rgba(232, 238, 255, .78); font-weight: 800; }
/* a reply's quote (js/chat.js lineHtml): one small muted line, cut with an ellipsis */
.m-quote { display: block; max-width: 100%; margin: 1px 0 2px; padding-left: 7px; border-left: 2px solid rgba(255, 255, 255, .28);
  font-size: .78em; line-height: 1.35; color: rgba(232, 238, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-at { color: #9fe1ff; font-weight: 800; }
.m-tag { color: #b7a6ff; font-weight: 800; padding: 0 5px; border-radius: 6px; background: rgba(150, 120, 255, .16); }
.m-at:hover, .m-tag:hover { filter: brightness(1.2); text-decoration: underline; }
.chat-logwrap { position: relative; display: flex; flex-direction: column; min-height: 0; }
.chat-empty { display: grid; justify-items: center; gap: 4px; padding: 18px 12px; text-align: center; color: var(--muted); }
.chat-empty .ic { width: 28px; height: 28px; opacity: .8; }
.chat-empty b { color: #fff; font-size: 13.5px; }
.chat-empty p { margin: 0; font-size: 12px; max-width: 30ch; }
.chat-empty .btn { margin-top: 6px; }
.chat-new {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: 800 12px Nunito, sans-serif; box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.chat-new .ic { width: 14px; height: 14px; }
.chat-new[hidden], .chat-filter[hidden], .chat-pop[hidden] { display: none; }
#chat:not([data-state="expanded"]) .chat-new, #chat:not([data-state="expanded"]) .chat-filter { display: none; }
/* load older (js/chat.js loadOlder): the row above the first line; the tab's ⋯ menu only on the full chat */
.chat-top { display: flex; justify-content: center; align-items: center; gap: 6px; min-height: 26px; padding: 2px 0 4px; font-size: 11.5px; color: var(--muted); }
.chat-top.start { opacity: .75; }
.chat-more { border: 0; padding: 4px 10px; border-radius: 999px; background: var(--surface); color: #cfe0ff; font: 800 11.5px Nunito, sans-serif; cursor: pointer; }
.chat-more:hover, .chat-more:focus-visible { background: var(--surface-2); outline: none; }
.chat-spin { width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #9fe1ff; border-radius: 50%; animation: chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-spin { animation-duration: 2.4s; } }
#chat:not([data-state="expanded"]) #chat-opts { display: none; }
/* long press on a line (js/chat.js): it lights up while pressed, and the phone's own text selection / callout stays off it */
#chat-log .msg.pl.lp { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; background: rgba(159, 225, 255, .1); transition: background .3s .1s; }
#chat-log .msg.pl:focus { outline: none; }
#chat-log .msg.pl:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-menu .cm-note { margin: 0 8px 6px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.chat-filter { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); background: rgba(150, 120, 255, .1); }
.chat-filter b { color: #b7a6ff; }
.chat-filter .chat-ibtn { margin-left: auto; width: 26px; height: 26px; }
#chat-form.ro #chat-input { background: rgba(0, 0, 0, .15); border-style: dashed; }
#chat-form.ro .chat-send { opacity: .35; pointer-events: none; }
/* Trade cards: picture · name and details · price and action, one compact row */
.tradecard {
  display: flex; align-items: center; gap: 9px; width: 100%; margin: 3px 0 1px; padding: 6px 8px; text-align: left; font: inherit; color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03)); border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
button.tradecard:hover, button.tradecard:focus-visible { border-color: var(--accent-2); background: rgba(255, 255, 255, .09); }
.tradecard.shiny { border-color: rgba(255, 207, 74, .45); }
.tradecard.ended { opacity: .55; }
.tradecard.static { cursor: default; }
.tradecard.static .tc-act.ghost { display: none; }
.tc-pic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: rgba(0, 0, 0, .28); overflow: hidden; }
.tc-pic img { width: 100%; height: 100%; object-fit: contain; }
.tc-pic .item-art { width: 32px; height: 32px; display: grid; place-items: center; }
.tc-pic .item-art img, .tc-pic .item-art svg { width: 100%; height: 100%; object-fit: contain; }
.tc-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.tc-main b { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-main small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-shiny { margin-left: 4px; font-style: normal; color: #ffcf4a; }
.tc-side { flex: none; display: grid; justify-items: end; gap: 3px; }
.tc-price { font-weight: 900; color: #ffe08a; font-size: 13px; font-variant-numeric: tabular-nums; }
.tc-price small { color: var(--muted); font-weight: 700; font-size: 10.5px; }
.tc-act { font: 900 11px/1 Nunito, sans-serif; padding: 5px 10px; border-radius: 999px; background: var(--accent); color: #fff; }
.tc-act.ghost { background: var(--surface-2); color: #dfe8ff; }
.tc-status { font: 900 11px/1 Nunito, sans-serif; padding: 5px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; text-transform: uppercase; letter-spacing: .04em; }
/* pop-ups inside the chat card: the player menu, the share / details sheet, the autocomplete list */
.chat-pop { position: absolute; z-index: 3; background: rgba(16, 25, 52, .98); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.chat-menu { width: 174px; padding: 4px; display: grid; }
.chat-menu .cm-head { padding: 6px 8px 4px; font-weight: 900; color: #ffe08a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-menu button { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border: 0; border-radius: 8px; background: none; color: #e8eeff; font: 700 13px Nunito, sans-serif; text-align: left; }
.chat-menu button:hover, .chat-menu button:focus-visible { background: var(--surface-2); outline: none; }
.chat-menu .ic { width: 16px; height: 16px; }
.chat-ac { left: 6px; right: 6px; bottom: 50px; padding: 4px; display: grid; max-height: 200px; overflow-y: auto; }
.chat-ac button { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: #e8eeff; font: 700 13px Nunito, sans-serif; text-align: left; }
.chat-ac button.on { background: var(--accent); color: #fff; }
.chat-ac small { margin-left: auto; color: inherit; opacity: .7; font-size: 11px; }
.chat-sheet { left: 6px; right: 6px; bottom: 50px; max-height: calc(100% - 58px); padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.chat-sheet > * { flex: none; }
/* room for the sheet: the log grows while it is open (the card is the sheet's frame) */
#chat:has(#chat-sheet:not([hidden])) #chat-log { min-height: 250px; }
.cs-head { display: flex; align-items: center; gap: 8px; }
.cs-head > b { font-size: 13px; }
.cs-head .chat-ibtn { margin-left: auto; }
.cs-seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(0, 0, 0, .3); }
.cs-seg .seg-b { border: 0; background: none; color: var(--muted); font: 800 12px Nunito, sans-serif; padding: 4px 10px; border-radius: 999px; }
.cs-seg .seg-b.on { background: var(--surface-2); color: #fff; }
.cs-grid { flex: 0 1 auto !important; min-height: 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; max-height: 190px; overflow-y: auto; }
.chat-sheet .cs-stats { overflow-y: auto; min-height: 0; flex: 0 1 auto; }
.cs-grid > p { grid-column: 1 / -1; margin: 6px 2px; font-size: 12.5px; }
.cs-pick { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: #fff; font: inherit; }
.cs-pick b { font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-pick small { font-size: 10.5px; color: var(--muted); }
.cs-pick.sel { border-color: var(--gold); background: rgba(255, 207, 74, .12); }
.cs-go { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cs-go[hidden] { display: none; }
.cs-sel { flex: 1; min-width: 80px; font-weight: 800; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 12.5px; }
.cs-stats dt { color: var(--muted); }
.cs-stats dd { margin: 0; }
.cs-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-sheet .btn .ic, .cs-actions .ic { width: 16px; height: 16px; }
#chat-form { display: flex; gap: 6px; padding: 6px; align-items: center; border-top: 1px solid var(--line); }
#chat-input { flex: 1; min-width: 0; background: rgba(0, 0, 0, .3); border: 1px solid var(--line-2); color: #fff; border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 13px; }
#chat-input:focus { border-color: var(--accent-2); }
#chat-input::placeholder { color: var(--muted); opacity: .8; }
#chat-form button { flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; background: linear-gradient(var(--gold), var(--gold-2)); border: 0; color: #3a2400; border-radius: 10px; }
#chat-form button.chat-share { background: var(--surface-2); color: #fff; border: 1px solid var(--line-2); }
#chat-form button[hidden] { display: none; }
#chat-form button .ic { width: 18px; height: 18px; }
.ct-n.hot { background: var(--danger); }
/* Guild tab locked until you join a guild; private conversation tabs (name, unread, X); World's price / countdown */
.ct-lock, .ct-pm { display: inline-grid; place-items: center; }
.ct-lock .ic, .ct-pm .ic { width: 12px; height: 12px; }
.ct.locked { opacity: .7; }
.ct.ct-dm { padding-right: 4px; color: #cdbdff; }
.ct.ct-dm.active { color: #fff; background: rgba(150, 120, 255, .28); }
.ct-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; margin-left: 1px; color: var(--muted); }
.ct-x:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.ct-x .ic { width: 11px; height: 11px; }
html.touch .ct-x { width: 28px; height: 28px; margin: -4px -4px -4px 0; }
html.touch .ct-x .ic { width: 13px; height: 13px; }
.chat-empty.locked .ic { color: var(--gold); }
.chat-cost { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; height: 26px; border-radius: 8px; font-size: 12px; font-weight: 900; color: var(--gold);
  background: rgba(255, 200, 60, .1); border: 1px solid rgba(255, 200, 60, .3); }
.chat-cost[hidden] { display: none; }
.chat-cost .ic { width: 14px; height: 14px; }
.chat-cost.wait { color: var(--muted); background: rgba(0, 0, 0, .2); border-color: var(--line-2); font-variant-numeric: tabular-nums; }
#chat-form button.chat-send:disabled { opacity: .35; }
#chat-form.trade .chat-send { display: none; }
#chat-form.trade #chat-input { cursor: pointer; }
.cs-why { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--gold); white-space: normal; }
.cs-why .ic { width: 12px; height: 12px; flex: none; }
.cs-pick small .ic { width: 11px; height: 11px; vertical-align: -1px; margin-right: 2px; }

/* ---------- move bar ---------- */
#movebar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; }
.moves { display: flex; flex-direction: column; gap: 8px; }   /* 2 × 2 around the ball: clears chat and hotbar */
@media (min-width: 1680px) { .moves { flex-direction: row; } }
.move.move-empty { visibility: hidden; pointer-events: none; }
.move {
  position: relative; width: 168px; height: 54px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 34px; text-align: left; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-2); border-left: 4px solid var(--c, var(--accent)); border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), border-color var(--t), background var(--t);
}
.move:hover:not(:disabled) { background: rgba(28, 42, 82, .92); }
.move:active:not(:disabled) { transform: scale(.96); }
.move:disabled { opacity: 0.45; cursor: not-allowed; }
.move .key, .hb .key { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; border-radius: 6px; background: rgba(255,255,255,.92); color: #13204a; font-size: 11px; font-weight: 900; display: grid; place-items: center; box-shadow: 0 1.5px 0 rgba(0,0,0,.35); }
.mv-name { flex: 1; min-width: 0; font-weight: 900; font-size: 13.5px; display: flex; flex-direction: column; line-height: 1.15; }
.mv-name small { color: var(--muted); font-size: 11px; font-weight: 800; }
.mv-type { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, #fff), var(--c) 60%, color-mix(in srgb, var(--c) 70%, #000)); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.mv-type i { font: 900 8.5px/1 Nunito, sans-serif; font-style: normal; color: rgba(10, 16, 40, .85); letter-spacing: .2px; }
html:not(.cb-types) .mv-type i { opacity: 0; }
#ball-btn {
  position: relative; width: 92px; height: 92px; border-radius: 50%; border: 1px solid var(--line-2); padding: 0;
  background: radial-gradient(circle at 50% 35%, #233a78, #0e1834 72%); display: grid; place-items: center; box-shadow: var(--shadow); margin-bottom: 2px;
  transition: transform var(--t) var(--ease);
}
#ball-btn .ball { width: 66%; height: 66%; display: block; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
#ball-btn.empty .ball { filter: grayscale(1) opacity(.5); }
#ball-count { position: absolute; top: -2px; right: -2px; background: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; font-size: 11.5px; font-weight: 900; padding: 1px 6px; }
#ball-btn .key { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); }
#ball-btn:active { transform: scale(0.94); }

/* ---------- launcher (desktop): primary row + "More" popover ---------- */
#menu { position: absolute; right: 12px; bottom: 88px; z-index: 3; }
.mn-primary { display: flex; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.mi { position: relative; display: grid; place-items: center; padding: 0; border: 0; background: none; border-radius: 12px; transition: transform var(--t) var(--ease); }
.mi .ic-tile { width: 48px; height: 48px; }
.mi:hover { transform: translateY(-2px); }
.mi:active { transform: scale(.9); transition-duration: 60ms; }
.mi-big .mi-label { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px); white-space: nowrap; pointer-events: none;
  background: var(--ink); border: 1px solid var(--line-2); padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; opacity: 0; transition: opacity var(--t), transform var(--t); }
.mi-big:hover .mi-label, .mi-big:focus-visible .mi-label { opacity: 1; transform: translateX(-50%); }
.mi-big .kbd { position: absolute; right: -3px; bottom: -3px; min-width: 16px; height: 16px; font-size: 9.5px; }
.mi .dot { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); border: 2px solid var(--ink); font: 900 9.5px/12px Nunito, sans-serif; font-style: normal; text-align: center; }
.mi .dot:empty { min-width: 12px; width: 12px; height: 12px; padding: 0; }
.mi .dot[hidden] { display: none; }
.mn-more { display: none; position: absolute; right: 0; bottom: calc(100% + 8px); width: 452px; max-height: calc(calc(100 * var(--uvh, 1vh)) - 220px); overflow: auto; padding: 10px 12px 12px;
  background: rgba(13, 21, 44, .96); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow);
  transform-origin: bottom right; animation: pop-in 180ms var(--ease); }
#menu.more-open .mn-more { display: block; }
#menu.more-open .mi-more { box-shadow: 0 0 0 2px var(--accent-2); border-radius: 14px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.mn-sec h4 { margin: 4px 2px 8px; font-size: 11px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.mn-sec + .mn-sec { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mn-sec-primary, .mn-more .sheet-grip { display: none; }
.mn-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.mn-grid .mi { display: flex; flex-direction: column; gap: 5px; padding: 8px 2px 7px; border-radius: 14px; min-height: 92px; }
.mn-grid .mi:hover { background: var(--surface); transform: none; }
.ic-bare { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45)); overflow: visible; }
.mn-grid .mi .ic-bare { width: 56px; height: 56px; transition: transform 220ms var(--ease); }
.mn-grid .mi:hover .ic-bare { transform: translateY(-2px) scale(1.06); }
.mn-grid .mi-label { font-size: 12.5px; font-weight: 800; line-height: 1.1; text-align: center; color: #e4eaff; }
.mn-grid .kbd { position: absolute; top: 4px; right: 6px; min-width: 16px; height: 16px; font-size: 9.5px; opacity: .85; }
.mn-grid .mi .dot { top: 4px; right: auto; left: calc(50% + 12px); }
/* grouped launcher (js/hud.js mn-bands): every group is one band of five, the wallet and the Settings gear on top */
.mn-bands .mn-sec + .mn-sec { margin-top: 6px; padding-top: 6px; }
.mn-wallet { align-items: center; gap: 8px; }
.mn-head-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px 0 10px; border-radius: 19px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: 800 13px Nunito, sans-serif; transition: background var(--t), transform var(--t) var(--ease); }
.mn-head-btn .ic { width: 20px; height: 20px; transition: transform 400ms var(--ease); }
.mn-head-btn:hover { background: var(--surface-2); }
.mn-head-btn:hover .ic { transform: rotate(60deg); }
.mn-head-btn:active { transform: scale(.94); }
/* "New": a feature that just unlocked wears a gold tag until it is opened once (main.js syncMenuLocks) */
.mi .new { display: none; position: absolute; top: 2px; left: 50%; transform: translateX(-50%); padding: 1px 6px; border-radius: 8px; background: linear-gradient(var(--gold), var(--gold-2));
  color: #2a1a00; font: 900 9px/13px Nunito, sans-serif; font-style: normal; letter-spacing: .4px; text-transform: uppercase; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); pointer-events: none; z-index: 1; }
.mi.is-new .new { display: block; animation: new-bob 1.8s ease-in-out infinite; }
.mi-big.is-new .new { top: -8px; }
.mi.is-new .ic-bare { filter: drop-shadow(0 0 10px rgba(255, 207, 74, .55)) drop-shadow(0 3px 4px rgba(0, 0, 0, .45)); }
@keyframes new-bob { 50% { transform: translateX(-50%) translateY(-2px); } }
#mn-more-btn.has-new .ic-bare { animation: new-glow 1.8s ease-in-out infinite; }
@keyframes new-glow { 50% { filter: drop-shadow(0 0 8px rgba(255, 207, 74, .8)); } }
/* the launcher's tiles pop in one after another (--i set by js/hud.js); never with reduced motion */
#menu.more-open .mn-grid .mi { animation: mi-in 260ms var(--ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
@keyframes mi-in { from { opacity: 0; transform: translateY(8px) scale(.92); } }
html.reduce-motion .mn-grid .mi, html.reduce-motion .mi .new, html.reduce-motion #mn-more-btn .ic-bare { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .mn-grid .mi, .mi .new, #mn-more-btn .ic-bare { animation: none !important; } }

/* ---------- hotbar ---------- */
#hotbar { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.hb { position: relative; width: 56px; height: 56px; padding: 0; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; transition: transform var(--t) var(--ease), border-color var(--t); }
.hb:hover { border-color: var(--line-2); }
.hb:active { transform: scale(.94); }
.hb .item-art { width: 42px; height: 42px; }
.hb .key { left: 3px; top: 4px; transform: none; width: 15px; height: 15px; font-size: 9px; border-radius: 4px; }
.hb .cnt { position: absolute; bottom: 2px; right: 4px; font-size: 10.5px; font-weight: 900; text-shadow: 0 1px 2px #000; }
.hb.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(255, 207, 74, .45); }
.hb.out { opacity: .5; }
.hb.empty { color: var(--muted); border-style: dashed; }
.hb.empty .ic { width: 22px; height: 22px; }
.hb.mount img.portrait { width: 50px; height: 50px; object-fit: contain; }

/* ---------- item art (HD art, 3D balls, smoothed sprite fallback) ---------- */
.item-art { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; position: relative; }
.item-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); }
.item-art.sprite { border-radius: 28%; background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 70%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.item-art.sprite img { inset: 11%; width: 78%; height: 78%; image-rendering: auto; }
.item-art.gen img { filter: none; }
.item-art.r3d img, img.ball3d[data-i3d-done] { filter: none; inset: 0; width: 100%; height: 100%; image-rendering: auto; }
.item-art.ball .ball3d { position: absolute; inset: 6%; width: 88%; height: 88%; }
.item-art.xs { width: 20px; height: 20px; }
.item-art.sm { width: 34px; height: 34px; }
.item-art.md { width: 52px; height: 52px; }
.item-art.lg { width: 72px; height: 72px; }

/* ---------- prompt / toast / loading ---------- */
#prompt {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); background: rgba(10, 17, 40, .88); border: 1px solid var(--line-2);
  padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; opacity: 0; transition: opacity .2s; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-sm);
}
#prompt.show { opacity: 1; }
#prompt b { color: var(--gold); }
#toast {
  position: absolute; left: 50%; top: 24%; transform: translate(-50%, -8px); background: rgba(13, 21, 44, .95); color: #fff; border: 1px solid rgba(255, 207, 74, .6);
  font-weight: 800; font-size: 14px; padding: 10px 20px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; transition: opacity .22s, transform .22s var(--ease); pointer-events: none;
  max-width: calc(calc(100 * var(--uvw, 1vw)) - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
/* the shared pop-up lane (js/notify.js): one banner at a time (celebrations, Adventure news, progress pills) with the
   toast under it; js places the lane in the free strip at the top of the screen, clear of the HUD */
#notify-lane { position: fixed; z-index: 600; left: 50%; top: 12px; width: min(400px, calc(calc(100 * var(--uvw, 1vw)) - 24px)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
#notify-lane .cel-wrap, #notify-lane #pg-fx { position: static; inset: auto; transform: none; width: 100%; align-self: stretch; }
#notify-lane #pg-fx:empty, #notify-lane .cel-wrap:empty { display: none; }
#notify-lane #toast { position: static; transform: translateY(-6px); width: max-content; max-width: 100%; box-sizing: border-box; }
#notify-lane #toast.show { transform: none; }
#notify-lane #toast:not(.show) { visibility: hidden; }
#notify-lane #update-pill, #notify-lane #notice-bar { position: static; inset: auto; transform: none; width: auto; max-width: 100%; }
#notify-lane #update-pill { pointer-events: auto; }
#notify-lane #notice-bar { align-self: stretch; }
body:has(#panel-root.open) #notify-lane #update-pill, html.menu-open #notify-lane #update-pill { display: none; }   /* waits until the panel / menu sheet is closed */
/* the install nudge waits too (it sat over the menu sheet) */
body:has(#panel-root.open) .inst-nudge, html.menu-open .inst-nudge, html.in-fight .inst-nudge { display: none; }
#loading { position: fixed; inset: 0; background: #0e1630; display: grid; place-content: center; justify-items: center; gap: 16px; transition: opacity .6s; z-index: 10; }
#loading.hide { opacity: 0; pointer-events: none; }
.ld-ball { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(#ee4040 0 46%, #222 46% 54%, #f5f5f5 54%); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-weight: 900; color: var(--muted); }
#help-card { order: 3; padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
#help-card[hidden] { display: none; }
.help-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.help-head b { color: #fff; font-size: 13px; }
#help-x { background: none; border: 0; color: var(--muted); width: 26px; height: 26px; border-radius: 6px; }
#help-x:hover { background: var(--surface-2); color: #fff; }
#help-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; margin: 0; align-items: center; }
#help-card dt { white-space: nowrap; }
#help-card dd { margin: 0; }
#help-card kbd { margin-right: 2px; }

@media (max-width: 1180px) {
  #help-card { display: none; }
  .move { width: 150px; }
  #party { width: 200px; }
}
/* Mid-size windows: slimmer move bar, filled hotbar slots only, chat sized to the space left of the moves */
@media (max-width: 1100px) and (min-width: 761px) {
  html:not(.touch) .move { width: 128px; padding-right: 8px; }
  html:not(.touch) .mv-name { font-size: 12.5px; white-space: nowrap; }
  html:not(.touch) .mv-name, html:not(.touch) .mv-name small { overflow: hidden; text-overflow: ellipsis; }
  html:not(.touch):not(.cb-types) .mv-type { display: none; }   /* the coloured edge carries the type */
  html:not(.touch) #ball-btn { width: 80px; height: 80px; }
  html:not(.touch) #hotbar .hb { width: 48px; height: 48px; }
  html:not(.touch) #hotbar .hb .item-art, html:not(.touch) #hotbar .hb.mount img.portrait { width: 36px; height: 36px; }
  html:not(.touch) #hotbar .hb.empty { display: none; }
  html:not(.touch) #hotbar:not(:has(.hb:not(.empty))) { display: none; }
  html:not(.touch) #menu { bottom: 80px; }
  html:not(.touch) #hud:not(:has(#hotbar .hb:not(.empty))) #menu { bottom: 12px; }
  html:not(.touch) #chat:not([data-state="expanded"]) { width: clamp(200px, calc(calc(50 * var(--uvw, 1vw)) - 196px), 340px); }
}

/* Narrow windows without touch (phone-width desktop browsers). Bottom area, nothing overlapping:
   menu bar centred along the bottom edge · filled hotbar slots as a column on the right · ball beside it ·
   chat (bubble / ticker / panel) bottom-left above the menu bar. Top: party left, minimap + icon buttons right,
   quest tracker under them. */
@media (max-width: 760px) {
  #minimap { width: 160px; }
  #minimap-view { height: 110px; }
  #party { width: 150px; gap: 4px; }
  .pm { grid-template-columns: 32px 1fr; padding: 3px 6px 3px 3px; }
  .pm-icon { width: 32px; height: 32px; }
  .pm-top { font-size: 11px; }
  .hp { height: 9px; margin-top: 3px; }
  .hp span { display: none; }
  #prompt { bottom: auto; top: 160px; font-size: 11px; }
}
/* up to 900px without touch: menu bar along the bottom, hotbar + ball on the right, chat on the left (touch uses mobile.css) */
@media (max-width: 900px) {
  html:not(.touch) #prompt { bottom: auto; top: 160px; font-size: 11px; }
  html:not(.touch) {
    --nb: 8px;                                       /* bottom gutter */
    --nrow: 66px;                                    /* menu bar height + gap: everything else starts above it */
  }
  html:not(.touch) #help-card { display: none; }
  html:not(.touch) #top-right { top: 8px; right: 8px; flex-direction: column; align-items: flex-end; gap: 6px; }
  html:not(.touch) #minimap { order: -1; }
  html:not(.touch) .top-buttons { gap: 4px; max-width: none; flex-wrap: nowrap; align-items: center; }
  html:not(.touch) .tb { width: 40px; height: 40px; padding: 0; border-radius: 12px; }
  html:not(.touch) .tb-label { display: none; }
  html:not(.touch) .tb-ic, html:not(.touch) .tb-ic .ic-tile { width: 30px; height: 30px; }
  html:not(.touch) .sq-head { padding: 7px 9px; gap: 8px; }
  html:not(.touch) .sq-ic { width: 26px; height: 26px; padding: 5px; }
  html:not(.touch) .sq-title { font-size: 13.5px; }
  html:not(.touch) .sq-body { padding: 0 10px 9px; }
  html:not(.touch) #menu { right: auto; left: 50%; bottom: var(--nb); transform: translateX(-50%); }
  html:not(.touch) .mn-primary { gap: 4px; padding: 4px; border-radius: 16px; }
  html:not(.touch) .mn-primary .mi-big .ic-bare, html:not(.touch) .mn-primary .mi .ic-tile { width: min(44px, calc((calc(100 * var(--uvw, 1vw)) - 64px) / 7)); height: min(44px, calc((calc(100 * var(--uvw, 1vw)) - 64px) / 7)); }
  html:not(.touch) .mn-more { right: 50%; transform: translateX(50%); width: min(452px, calc(calc(100 * var(--uvw, 1vw)) - 16px)); transform-origin: bottom center; }
  html:not(.touch) #hotbar { right: 8px; bottom: calc(var(--nb) + var(--nrow)); flex-direction: column-reverse; gap: 4px; padding: 4px; border-radius: 14px; }
  html:not(.touch) #hotbar .hb { width: 44px; height: 44px; border-radius: 11px; }
  html:not(.touch) #hotbar .hb .item-art, html:not(.touch) #hotbar .hb.mount img.portrait { width: 32px; height: 32px; }
  html:not(.touch) #hotbar .hb.empty { display: none; }
  html:not(.touch) #hotbar:not(:has(.hb:not(.empty))) { display: none; }
  html:not(.touch) #movebar { left: auto; transform: none; right: calc(8px + 54px + 8px); bottom: calc(var(--nb) + var(--nrow)); }
  html:not(.touch) #hud:not(:has(#hotbar .hb:not(.empty))) #movebar { right: 8px; }
  /* the four moves: a row of compact buttons above the chat / ball while a wild Pokémon is near (keys 1–4 always work) */
  html:not(.touch) .moves { display: none; }
  html:not(.touch).foes-near .moves { display: flex; position: fixed; flex-direction: row; gap: 6px; bottom: calc(var(--nb) + var(--nrow) + 80px); width: calc(calc(50 * var(--uvw, 1vw)) - 12px); z-index: 3; }
  html:not(.touch).foes-near #moves-left { left: 8px; }
  html:not(.touch).foes-near #moves-right { right: 8px; }
  /* a hotbar column on the right: the row stops short of it */
  html:not(.touch).foes-near #hud:has(#hotbar .hb:not(.empty)) .moves { width: calc((calc(100 * var(--uvw, 1vw)) - 16px - 60px - 6px) / 2); }
  html:not(.touch).foes-near #hud:has(#hotbar .hb:not(.empty)) #moves-right { right: calc(8px + 60px); }
  html:not(.touch).foes-near .move { flex: 1 1 0; min-width: 0; width: auto; height: 44px; padding: 0 6px 0 26px; }
  html:not(.touch).foes-near .move .key { left: 5px; width: 16px; height: 16px; font-size: 10px; }
  html:not(.touch).foes-near .mv-name { font-size: 11.5px; white-space: nowrap; }
  html:not(.touch).foes-near .mv-name, html:not(.touch).foes-near .mv-name small { overflow: hidden; text-overflow: ellipsis; }
  html:not(.touch).foes-near .mv-type { display: none; }
  html:not(.touch) #ball-btn { width: 68px; height: 68px; margin: 0; }
  html:not(.touch) #chat { left: 8px; bottom: calc(var(--nb) + var(--nrow)); width: calc(calc(100 * var(--uvw, 1vw)) - 16px - 54px - 8px - 68px - 12px); }
  html:not(.touch) #chat[data-state="expanded"] { width: calc(calc(100 * var(--uvw, 1vw)) - 16px); }
  html:not(.touch) #chat-log { height: min(190px, calc(26 * var(--uvh, 1vh))); }
}
/* 761–900px: same bottom layout, but there is still room for the four moves left of the ball; the chat stops short of them */
@media (min-width: 761px) and (max-width: 900px) {
  html:not(.touch) .moves { display: flex; gap: 6px; }
  html:not(.touch) .move { width: 120px; height: 46px; }
  html:not(.touch) #movebar { gap: 8px; }
  html:not(.touch) #chat, html:not(.touch) #chat[data-state="expanded"] { width: clamp(180px, calc(var(--mb-left, 400px) - 20px), 360px); }
}
#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 5; }
#fade.on { opacity: 1; }

/* ---------- modal / sheet shell (js/ui.js) ---------- */
#panel-root { position: fixed; inset: 0; display: none; place-items: center; background: rgba(4, 8, 22, 0.6); z-index: 8; pointer-events: auto; transition: background var(--t); }
#panel-root.open { display: grid; }
#panel-root.enter { animation: fade-in 200ms var(--ease); }
@keyframes fade-in { from { background: rgba(4, 8, 22, 0); } }
.modal {
  width: min(1040px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); max-height: calc(calc(100 * var(--uvh, 1vh)) - 40px); display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #16234a, #0f1834 60%); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  transition: transform 220ms var(--ease), opacity 220ms var(--ease);
}
.modal.size-md { width: min(720px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); }
/* no layout jump when switching tabs / views */
.modal.size-lg, .modal.tall { height: min(720px, calc(calc(100 * var(--uvh, 1vh)) - 40px)); }
.modal.size-lg .modal-body, .modal.tall .modal-body { flex: 1; }
.modal.size-sm { width: min(480px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); }
#panel-root.enter .modal { animation: modal-in 220ms var(--ease); }
@keyframes modal-in { from { transform: translateY(14px) scale(.985); opacity: 0; } }
.sheet-grip { display: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.mh-icon .ic-tile { width: 34px; height: 34px; display: block; }
.mh-title { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: .2px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-actions:empty { display: none; }
.modal-x { width: 40px; height: 40px; display: grid; place-items: center; flex: none; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: background var(--t), color var(--t); }
.modal-x svg { width: 20px; height: 20px; }
.modal-x:hover { background: var(--surface-2); color: #fff; }
.modal-body { padding: 16px; overflow: auto; overscroll-behavior: contain; }
.modal h3 { margin: 6px 0 10px; }
.muted { color: var(--muted); }

/* buttons, tabs, chips, switches (shared by every panel and the older modules) */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px; color: #fff;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 11px; font-weight: 800; font-size: 13.5px;
  transition: background var(--t), border-color var(--t), transform var(--t) var(--ease);
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.icon-only { padding: 0; width: 38px; }
.btn.sm.icon-only { width: 32px; }
.btn.primary, .btn.on, .btn.buy { background: linear-gradient(var(--gold), var(--gold-2)); color: #3a2400; border-color: rgba(255, 233, 168, .8); }
.btn.primary:hover:not(:disabled), .btn.buy:hover:not(:disabled) { background: linear-gradient(#ffe07a, #f5b030); }
.btn.danger { background: rgba(255, 95, 107, .14); border-color: rgba(255, 95, 107, .55); color: #ffb3b9; }
.btn.danger:hover:not(:disabled) { background: rgba(255, 95, 107, .26); }
.btn.buy { font-size: 17px; padding: 10px; width: 100%; }
.tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px; font-weight: 800; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); transition: background var(--t), color var(--t), border-color var(--t);
}
.tab .ic { width: 18px; height: 18px; }
.tab em { font-style: normal; font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 8px; background: rgba(0, 0, 0, .25); }
.tab:hover { color: #fff; }
.tab.on { background: #fff; color: #13204a; border-color: #fff; }
.tab.on em { background: rgba(19, 32, 74, .12); }
.type { background: var(--c); color: #12264d; border-radius: 6px; padding: 0 6px; font-size: 10px; font-weight: 900; text-transform: uppercase; }

/* reduced motion: OS setting or Settings → Accessibility */
@media (prefers-reduced-motion: reduce) {
  #hud *, #panel-root *, #m-ui * { animation: none !important; transition: none !important; }
}
html.reduce-motion #hud *, html.reduce-motion #panel-root *, html.reduce-motion #m-ui * { animation: none !important; transition: none !important; }
html.reduce-motion .qmark { animation: none !important; }
/* larger text (Settings → Accessibility) */
html.large-text .modal-body, html.large-text #chat-log, html.large-text .sq, html.large-text .tut, html.large-text #prompt, html.large-text #toast, html.large-text .mn-more { zoom: 1.14; }
html.large-text .pm-top, html.large-text .mv-name { font-size: 15px; }

/* ---------- FireRed world integration ---------- */
.emote { font-size: 22px; font-weight: 900; color: #ff3b3b; background: #fff; border: 2px solid #222; border-radius: 8px; padding: 0 8px; line-height: 1.2; animation: emote-pop .25s ease-out; }
@keyframes emote-pop { from { translate: 0 8px; scale: .4; } to { translate: 0 0; scale: 1; } }
.monpic { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); width: 180px; height: 180px; z-index: 7; background: rgba(255, 255, 255, .92); border: 3px solid #2d5bb3; border-radius: 16px; display: grid; place-items: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); }
.monpic img { width: 160px; height: 160px; object-fit: contain; }
.nick { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 10px; }
.nick input { font: inherit; font-size: 18px; padding: 6px 10px; border-radius: 8px; border: 2px solid #6c7cff; background: #0b1a3a; color: #fff; }
#title { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #3b5fb8, #0b1430 70%); font-family: Nunito, system-ui, sans-serif; color: #fff; }
.ti-card { width: min(420px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); display: flex; flex-direction: column; gap: 18px; align-items: stretch; text-align: center; }
.ti-logo { display: grid; justify-items: center; gap: 2px; }
.ti-logo .tc-logo { width: min(460px, calc(calc(100 * var(--uvw, 1vw)) - 24px)); height: auto; margin: 0 -20px; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .45)); }
.ti-logo small { display: block; font-size: 13px; font-weight: 900; color: #c8e7ff; letter-spacing: 3px; text-transform: uppercase; }
/* title / sign-in backdrop: drifting element embers behind the card */
#title::before, #title::after { content: ''; position: fixed; inset: -20%; pointer-events: none; z-index: -1; opacity: .55;
  background: radial-gradient(3px 3px at 12% 70%, #ffb45e, transparent), radial-gradient(2px 2px at 30% 85%, #7fd3ff, transparent),
    radial-gradient(3px 3px at 55% 75%, #8ff0a8, transparent), radial-gradient(2px 2px at 78% 88%, #ffe36e, transparent),
    radial-gradient(2px 2px at 90% 66%, #ffb45e, transparent), radial-gradient(3px 3px at 44% 95%, #ffe36e, transparent);
  animation: ti-embers 9s linear infinite; }
#title::after { animation-duration: 13s; animation-delay: -6s; transform: scale(1.3); opacity: .4; }
@keyframes ti-embers { from { transform: translateY(10%); } to { transform: translateY(-25%); } }
html.reduce-motion #title::before, html.reduce-motion #title::after { animation: none; }
.ti-menu, .ti-form { display: flex; flex-direction: column; gap: 10px; }
.ti-menu .btn, .ti-start { font-size: 20px; padding: 12px; }
.ti-menu .btn small { display: block; font-size: 12px; opacity: .8; font-weight: 700; }
.ti-form label { display: flex; flex-direction: column; text-align: left; gap: 4px; font-weight: 800; font-size: 13px; color: #c8e7ff; }
.ti-form input { font: inherit; font-size: 18px; padding: 8px 10px; border-radius: 8px; border: 2px solid #6c7cff; background: #0b1a3a; color: #fff; }
.ti-gender { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ti-g { font: inherit; padding: 12px; border-radius: 12px; border: 2px solid #3a6fc9; background: #102048; color: #fff; cursor: pointer; }
.ti-g b { display: block; font-size: 18px; }
.ti-g small { opacity: .75; }
.ti-g.on { border-color: #ffcb05; background: #1d3570; box-shadow: 0 0 0 2px #ffcb05 inset; }
.ti-warn { color: #ffb46b; font-size: 12px; margin: 0; }
#title [hidden] { display: none !important; }

/* ---------- character creation ---------- */
.cc { width: 100%; display: grid; place-items: center; }
.cc-card { width: min(640px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); display: flex; flex-direction: column; gap: 14px; background: rgba(10, 22, 52, .82); border: 2px solid #3a6fc9; border-radius: 16px; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.cc-wide { width: min(760px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); }
.cc h2 { margin: 0; text-align: center; color: #ffcb05; font-size: 26px; font-weight: 900; }
.cc-toggle { display: flex; justify-content: center; gap: 8px; }
.cc-g { font: inherit; font-weight: 900; padding: 6px 22px; border-radius: 999px; border: 2px solid #3a6fc9; background: #102048; color: #fff; cursor: pointer; }
.cc-g.on { background: #ffcb05; color: #10204a; border-color: #ffcb05; }
.cc-bases { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cc-base { font: inherit; color: #fff; background: #13285a; border: 2px solid #2d5bb3; border-radius: 14px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cc-base.on { border-color: #ffcb05; box-shadow: 0 0 0 2px #ffcb05 inset; }
.cc-base canvas { width: 100%; aspect-ratio: 3 / 4; display: block; }
.cc-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cc-actions .cc-start, .cc-actions .cc-next { font-size: 17px; padding: 8px 22px; }
.cc-split { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
.cc-tcard { background: linear-gradient(#f6f1d8, #e4d9a8); color: #2a2a2a; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; align-items: center; border: 3px solid #c9a227; }
.cc-tcard-head { font-weight: 900; letter-spacing: 2px; font-size: 12px; color: #8a6d12; }
.cc-tcard canvas { width: 100%; aspect-ratio: 3 / 4; cursor: grab; }
.cc-tcard-name { font-weight: 900; font-size: 18px; }
.cc-tcard small { color: #6b5a22; }
.cc-rows { display: flex; flex-direction: column; gap: 8px; }
.cc-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: #c8e7ff; }
.cc-sw { display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; min-width: 0; }
.cc-sw button, .cc-custom { flex: 0 1 28px; min-width: 18px; aspect-ratio: 1; border-radius: 50%; border: 2px solid #0a1630; background: var(--c); cursor: pointer; padding: 0; }
.cc-sw button.on, .cc-custom.on { outline: 3px solid #ffcb05; outline-offset: 1px; }
/* any colour: a rainbow ring round the picked colour, the native picker hidden inside */
.cc-custom { position: relative; border: 0; background: radial-gradient(circle, var(--c) 0 46%, transparent 50%), conic-gradient(#ff5a5a, #ffd23f, #4fd17a, #46a8ff, #9b6ad6, #ff5a5a); }
.cc-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.cc-actions2 { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.cc-minor { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-minor .btn { min-height: 44px; padding: 6px 8px; font-size: 14px; }
.cc-actions2 .cc-start { min-height: 54px; border: 0; border-radius: 16px; font: 900 18px Nunito, sans-serif; color: #2b1800; background: linear-gradient(180deg, #ffe066, #ff9f1c); box-shadow: 0 10px 30px rgba(255, 159, 28, .35); }
.cc-field { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 13px; color: #c8e7ff; }
.cc-field input { font: inherit; font-size: 17px; padding: 7px 10px; border-radius: 8px; border: 2px solid #6c7cff; background: #0b1a3a; color: #fff; }
.cc-err { color: #ff8a8a; font-weight: 800; }
.cc-note { margin: -2px 0 8px; font: 700 12.5px/1.35 Nunito, sans-serif; opacity: .85; }
.cc-name[readonly] { opacity: .8; cursor: default; }
@media (max-width: 640px) { .cc-split { grid-template-columns: 1fr; } .cc-tcard canvas { max-height: 200px; } }
.btn { color: #fff; }
#title { overflow-y: auto; padding: 16px 0; }

/* ---------- quests, tutorial, starter ---------- */
.qmark { font-weight: 900; font-size: 24px; line-height: 1; color: #ffd23f; text-shadow: 0 2px 0 #7a5200, 0 0 8px rgba(0, 0, 0, .7); animation: qbob 1.1s ease-in-out infinite; pointer-events: none; }
.qmark.q { background: #ffd23f; color: #3a2a00; border: 2px solid #fff; border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; text-shadow: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.qmark.x { color: #ff4d4d; text-shadow: 0 2px 0 #fff, 0 0 8px rgba(0, 0, 0, .6); font-size: 28px; }
.qmark.beacon { width: 1px; height: 1px; animation: none; }   /* the light column marks it (js/main.js questBeam) */
@keyframes qbob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
#ball-btn.pulse { animation: ballpulse .7s ease-in-out infinite; }
@keyframes ballpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 210, 63, .9); } 50% { box-shadow: 0 0 0 12px rgba(255, 210, 63, 0); } }

/* "A new update is ready · Refresh" (js/main.js version check) */
#update-pill { position: fixed; z-index: 100; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 14px; border-radius: 999px; background: rgba(13, 21, 44, .96); border: 1px solid rgba(255, 207, 74, .7); box-shadow: var(--shadow);
  font-weight: 800; font-size: 13.5px; white-space: nowrap; animation: pop-in 220ms var(--ease); }
#update-pill .up-x { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.ch-Guild { color: #b6f0a0; }

/* moves slide in only while a wild Pokémon is near or targeted (js/mobile.js .foes-near); keys 1–4 always work */
html:not(.touch) .moves { transition: opacity .2s, transform .25s var(--ease), visibility 0s; }
html:not(.touch):not(.foes-near) .moves { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(12px); transition: opacity .2s, transform .25s var(--ease), visibility 0s .25s; }
/* damage numbers from the world never float over an open panel */
body:has(#panel-root.open) .float-text { display: none; }
@media (max-height: 430px), (max-width: 480px) {
  #update-pill { font-size: 12px; gap: 6px; padding: 3px 3px 3px 10px; }
  #update-pill .btn { min-height: 30px; padding: 0 10px; font-size: 12px; }
  #update-pill .up-x { width: 26px; height: 26px; font-size: 17px; }
}

/* Shiny Hunt countdown chip (js/main.js huntChip): top centre, under the top HUD; tap = show the route on the map */
#hunt-chip { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: 196px;   /* desktop: above the prompt line and the move bar, clear of the trainer */
  display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border-radius: 999px; border: 1.5px solid rgba(255, 220, 120, .9);
  background: linear-gradient(135deg, rgba(255, 196, 64, .95), rgba(214, 112, 22, .95)); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.35);
  font: 800 12px/1.15 Nunito, system-ui, sans-serif; text-align: left; animation: hunt-glow 1.6s ease-in-out infinite; max-width: calc(calc(100 * var(--uvw, 1vw)) - 24px); }
#hunt-chip .hc-spark { font-size: 16px; }
#hunt-chip .hc-t { display: grid; min-width: 0; }
#hunt-chip .hc-t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hunt-chip .hc-t small { font-size: 11px; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hunt-chip .hc-time { font-variant-numeric: tabular-nums; background: rgba(0,0,0,.25); border-radius: 999px; padding: 3px 8px; font-weight: 900; }
#hunt-chip.here { border-color: #fff; }
@keyframes hunt-glow { 50% { box-shadow: 0 6px 18px rgba(0,0,0,.35), 0 0 18px 2px rgba(255, 210, 90, .7); } }
html.reduce-motion #hunt-chip { animation: none; }
/* phones: under the quest widget (js/mobile.js --q-bot) and below the Mall · Bag · Hub row under the minimap (its labels
   end about 173px down: the chip used to sit on the Bag label), between the party column and the right edge */
html.touch.portrait #hunt-chip { bottom: auto; top: calc(max(var(--q-bot, 130px), var(--sat, 0px) + 172px) + 8px); max-width: calc(calc(100 * var(--uvw, 1vw)) - 132px - var(--sal, 0px) - var(--sar, 0px)); }
/* landscape: the gap in the top row between the wallet and the right-hand icon column / minimap (the quest widget is below) */
html.touch.landscape #hunt-chip { bottom: auto; top: calc(var(--sat, 0px) + 6px); left: auto; right: calc(var(--sar, 0px) + 168px); transform: none; max-width: calc(calc(100 * var(--uvw, 1vw)) - 540px - var(--sal, 0px) - var(--sar, 0px)); }

/* ---------- server notices, gifts, moderator disconnect, reports (js/serverlink.js) ---------- */
#notice-bar { position: fixed; z-index: 12; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 8px); transform: translateX(-50%); width: min(560px, calc(calc(100 * var(--uvw, 1vw)) - 16px));
  display: grid; gap: 6px; pointer-events: none; }
.nb-row { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 12px; border-radius: 14px; color: #fff;
  background: color-mix(in srgb, var(--nb) 82%, #0b1430); border: 1px solid rgba(255,255,255,.35); box-shadow: 0 8px 22px rgba(0,0,0,.35);
  font: 800 13.5px/1.3 Nunito, system-ui, sans-serif; animation: pop-in 220ms var(--ease); }
.nb-t { flex: 1; min-width: 0; }
.nb-x { width: 32px; height: 32px; border: 0; border-radius: 10px; background: rgba(0,0,0,.18); color: #fff; font-size: 18px; flex: none; }
#gift-chip { position: absolute; z-index: 3; left: 50%; transform: translateX(-50%); bottom: 236px; display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 10px; border-radius: 999px; border: 1.5px solid #fff; color: #fff; font: 900 13px Nunito, sans-serif;
  background: linear-gradient(135deg, #ff6fae, #8a4dff); box-shadow: 0 6px 18px rgba(0,0,0,.35); animation: gift-bob 1.8s ease-in-out infinite; }
#gift-chip span { font-size: 18px; }
@keyframes gift-bob { 50% { transform: translate(-50%, -4px); } }
html.reduce-motion #gift-chip { animation: none; }
html.touch.portrait #gift-chip { bottom: auto; top: calc(var(--sat, 0px) + 104px); }
html.touch.landscape #gift-chip { bottom: auto; top: calc(var(--sat, 0px) + 96px); }
.gifts { display: grid; gap: 10px; }
.gift-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-2); }
.gift-ic { font-size: 30px; }
.gift-body b { display: block; font-size: 15px; }
.gift-body small { color: var(--muted); font-weight: 800; }
.gift-body p { margin: 6px 0 0; font-size: 13px; color: #d7e0ff; white-space: pre-line; }
.gift-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.gift-items span { font: 900 12px Nunito, sans-serif; padding: 3px 8px; border-radius: 8px; background: rgba(255, 207, 74, .16); color: #ffe7a0; }
@media (max-width: 480px) { .gift-card { grid-template-columns: auto 1fr; } .gift-card .gift-claim { grid-column: 1 / -1; } }
#kicked { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(4, 8, 22, .82); backdrop-filter: blur(6px); }
.kk-card { width: min(380px, calc(calc(100 * var(--uvw, 1vw)) - 32px)); padding: 22px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2); text-align: center; color: #fff; }
.kk-card h2 { margin: 0 0 8px; font: 900 22px Nunito, sans-serif; }
.kk-card p { color: var(--muted); font-weight: 700; margin: 0 0 16px; }
.report-form { display: grid; gap: 12px; }
.report-form p { margin: 0; color: var(--muted); font-weight: 700; }
.report-form textarea { font: 700 15px Nunito, sans-serif; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0,0,0,.3); color: #fff; resize: vertical; }

/* ---------- character select (main.js characterScreen) ---------- */
.ti-chars { width: min(520px, calc(calc(100 * var(--uvw, 1vw)) - 24px)); }
.chs-list { display: grid; gap: 10px; }
.chs-card { position: relative; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 18px; background: rgba(16, 30, 72, .82); border: 1.5px solid rgba(160, 190, 255, .28); color: #fff;
  cursor: pointer; font: inherit; transition: transform .15s, border-color .15s, background .15s; }
.chs-card:hover, .chs-card:focus-visible { transform: translateY(-2px); border-color: #ffd23f; background: rgba(24, 42, 96, .9); outline: none; }
.chs-card.chs-last { border-color: rgba(255, 210, 63, .75); box-shadow: 0 0 0 1px rgba(255, 210, 63, .3), 0 10px 24px rgba(0,0,0,.3); }
.chs-ava { width: 64px; height: 64px; border-radius: 16px; background: radial-gradient(circle at 50% 35%, #3a5bb8, #142553); overflow: hidden; display: grid; place-items: center; }
.chs-ava img { width: 100%; height: 100%; object-fit: contain; }
.chs-info { display: grid; gap: 2px; min-width: 0; }
.chs-info b { font-size: 18px; font-weight: 900; }
.chs-info small { color: #b9c8f0; font-weight: 800; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chs-crown { font-style: normal; }
.chs-party { display: flex; gap: 3px; margin-top: 4px; }
.chs-party i { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.08); display: grid; place-items: center; overflow: hidden; }
.chs-party i img { width: 86%; height: 86%; object-fit: contain; }
.chs-party i.shiny { box-shadow: 0 0 0 2px #ffd23f, 0 0 8px rgba(255,210,80,.5); }
.chs-tag { position: absolute; top: -9px; right: 14px; font: 900 10px Nunito, sans-serif; letter-spacing: .5px; text-transform: uppercase; color: #3a2400; background: #ffd23f; padding: 3px 8px; border-radius: 999px; }
.chs-del { align-self: start; width: 36px; height: 36px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.2); color: #fff; font-size: 15px; cursor: pointer; }
.chs-del:hover { background: rgba(220, 60, 60, .5); }
/* one slim "New character" button under the list (no empty slot cards) */
.chs-new { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 10px 14px; border-radius: 14px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(160, 190, 255, .2); color: #fff; font: inherit; transition: background .15s, border-color .15s; }
.chs-new:hover, .chs-new:focus-visible { background: rgba(255, 210, 63, .1); border-color: rgba(255, 210, 63, .6); outline: none; }
.chs-new .chs-plus { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font: 900 20px/1 Nunito, sans-serif; color: #3a2400; background: #ffd23f; }
.chs-new b { font-size: 15px; font-weight: 900; }
.chs-new small { margin-left: auto; color: #b9c8f0; font-weight: 800; font-size: 12.5px; }
.chs-account { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding: 0 4px; color: #b9c8f0; font-size: 13px; font-weight: 700; }
.chs-account span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chs-account b { color: #fff; }
.chs-out { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 8px 14px; border-radius: 12px; cursor: pointer; font: 800 14px Nunito, sans-serif;
  color: #ffd9d9; background: rgba(255, 90, 90, .08); border: 1px solid rgba(255, 120, 120, .35); transition: background .15s, border-color .15s; }
.chs-out:hover, .chs-out:focus-visible { background: rgba(255, 90, 90, .18); border-color: rgba(255, 140, 140, .7); outline: none; }
.chs-out svg { width: 18px; height: 18px; }
.chs-out:disabled { opacity: .6; cursor: default; }
.chs-confirm { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(120, 20, 30, .35); border: 1px solid rgba(255, 120, 120, .5); }
.chs-confirm p { margin: 0; color: #ffd9d9; font-weight: 700; font-size: 14px; }
.chs-confirm input { font: 700 16px Nunito, sans-serif; padding: 9px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: #0b1430; color: #fff; }
.chs-confirm div { display: flex; gap: 8px; justify-content: flex-end; }

/* the gold coin that replaces 🪙 everywhere (js/ui.js coinify) */
.gc { display: inline-block; width: .95em; height: .95em; margin: 0 .18em 0 .04em; vertical-align: -.12em; border-radius: 50%; font-style: normal;
  background: radial-gradient(circle at 35% 30%, #fff4b0 0 18%, #ffd23f 42%, #e09a12 78%); box-shadow: inset 0 0 0 .09em rgba(160, 96, 0, .55), 0 .05em .1em rgba(0, 0, 0, .35); }

/* building name tags (js/style/buildingtags.js): a small sign floating over the roof */
.bld-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; border-radius: 999px; pointer-events: none; white-space: nowrap;
  font: 800 12px/1.2 var(--font, inherit); color: #fff; background: rgba(12, 22, 52, .78); border: 1.5px solid rgba(255,255,255,.55);
  box-shadow: 0 2px 8px rgba(0,0,0,.35); text-shadow: 0 1px 2px rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.bld-tag i { font-style: normal; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 10px; background: #5b6b8f; }
.bld-tag.k-center { border-color: #ff8a8a; } .bld-tag.k-center i { background: #e8453c; }
.bld-tag.k-mart { border-color: #8ab8ff; } .bld-tag.k-mart i { background: #3b7be0; }
.bld-tag.k-gym { border-color: #ffd36b; color: #ffe9a8; } .bld-tag.k-gym i { background: #e0a21f; }
.bld-tag.k-lab { border-color: #9be7c4; } .bld-tag.k-lab i { background: #2fa37a; }
.bld-tag.k-home i { background: #c9773d; }
html.touch .bld-tag { font-size: 10.5px; padding: 2px 8px 2px 4px; } html.touch .bld-tag i { width: 15px; height: 15px; font-size: 8.5px; }

/* menu features that unlock later in the story: dimmed with a small lock */
#menu .mi.locked { opacity: .45; filter: grayscale(.7); position: relative; }
#menu .mi.locked::after { content: '🔒'; position: absolute; top: 4px; right: 6px; font-size: 11px; filter: none; }

/* install as an app (js/install.js): guide sheet + a one-time nudge */
.inst-sheet { position: fixed; inset: 0; z-index: 700; background: rgba(4,8,20,.6); display: grid; place-items: end center; }
@media (min-width: 761px) { .inst-sheet { place-items: center; } }
.inst-card { width: min(420px, 100%); box-sizing: border-box; padding: 18px 18px max(18px, env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--panel-solid, #16224a);
  border: 1px solid var(--line-2, #2c3d72); text-align: center; display: grid; gap: 10px; justify-items: center; }
@media (min-width: 761px) { .inst-card { border-radius: 20px; } }
.inst-card h3 { margin: 0; font-size: 19px; } .inst-card p { margin: 0; color: var(--muted, #a9b8e2); font-size: 14px; }
.inst-ic { width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.inst-steps { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.inst-steps li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.05); font-size: 14px; }
.inst-steps li > b { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #f2b84b; color: #1b1406; font-size: 13px; }
.inst-k { font-weight: 800; color: #fff; } .inst-share { width: 18px; height: 18px; vertical-align: -4px; color: #4da3ff; }
.inst-note { font-size: 12px !important; }
.inst-nudge { position: fixed; z-index: 650; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); width: min(380px, calc(calc(100 * var(--uvw, 1vw)) - 24px)); box-sizing: border-box;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: rgba(14,22,48,.95); border: 1px solid #f2b84b; box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: fade .25s; }
.inst-nudge img { width: 40px; height: 40px; border-radius: 10px; }
.inst-nudge span { flex: 1; display: flex; flex-direction: column; min-width: 0; } .inst-nudge small { color: var(--muted, #a9b8e2); font-size: 12px; }

/* calm panel headers: just the 3D object next to the title, no coloured tile behind it */
.modal-head .mh-icon .ic-m3d > :not(.ic-art) { display: none; }
.modal-head .mh-icon .ic-m3d { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); overflow: visible; }

/* the dock's 3D icons stand on their own, no tile behind them */
.mn-primary .mi-big .ic-bare { width: 48px; height: 48px; }

/* mandatory update (js/main.js): covers the game until refreshed */
#update-lock { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; padding: 16px; background: rgba(6, 10, 30, .78); backdrop-filter: blur(6px); }
#update-lock .ul-card { width: min(380px, 100%); text-align: center; padding: 26px 22px 20px; border-radius: 22px; background: linear-gradient(#1c2c74, #121c4c); border: 1px solid rgba(255, 210, 63, .5); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); color: #fff; }
#update-lock .ul-ic { font-size: 40px; line-height: 1; margin-bottom: 8px; }
#update-lock h2 { margin: 0 0 8px; font: 900 22px Nunito, sans-serif; }
#update-lock p { margin: 0 0 18px; color: #c9d6ff; font-weight: 700; }
#update-lock .btn { width: 100%; min-height: 52px; font-size: 17px; }
#update-lock small { display: block; margin-top: 10px; color: #9fb0e0; font-weight: 800; }
/* an unfinished battle after a reload (js/battlesave.js): Continue battle / Give up, before the player can move */
#battle-resume { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 16px; background: rgba(6, 10, 30, .78); backdrop-filter: blur(6px); }
#battle-resume .br-card { width: min(400px, 100%); text-align: center; padding: 24px 20px 18px; border-radius: 22px; background: linear-gradient(#1c2c74, #121c4c); border: 1px solid rgba(255, 210, 63, .5); box-shadow: 0 20px 60px rgba(0, 0, 0, .5); color: #fff; }
#battle-resume .br-ic { font-size: 40px; line-height: 1; margin-bottom: 8px; }
#battle-resume h2 { margin: 0 0 8px; font: 900 21px Nunito, sans-serif; }
#battle-resume p { margin: 0 0 14px; color: #c9d6ff; font-weight: 700; }
#battle-resume .br-facts { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
#battle-resume .br-facts span { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); color: #e6ecff; font-weight: 800; font-size: 13px; }
#battle-resume .btn { width: 100%; min-height: 50px; font-size: 17px; }
#battle-resume .br-quit { margin-top: 10px; min-height: 44px; font-size: 15px; background: transparent; border: 1px solid rgba(255, 255, 255, .25); color: #dfe6ff; }
#battle-resume small { display: block; margin-top: 8px; color: #9fb0e0; font-weight: 800; }

/* the bought-Pokémon level cap (js/boughtcap.js): a small lock on a party slot whose bought Pokémon is above the cap */
.pm.capped .pm-icon { position: relative; overflow: visible; }
.pm-cap { position: absolute; right: 1px; bottom: 1px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: #0b1430; color: #ffd56a; box-shadow: 0 0 0 1.5px rgba(255, 213, 106, .7); pointer-events: none; }
.pm-cap .ic { width: 12px; height: 12px; }
.pm.capped .pm-icon img { opacity: .78; }

/* Account: the "Verify your email" row stands out (+25 diamonds) */
#st-verify-row { background: linear-gradient(135deg, rgba(255, 210, 63, .18), rgba(255, 159, 28, .08)); border: 1px solid rgba(255, 210, 63, .55); }
#st-verify-row b::after { content: " +25 \1F48E"; color: #ffd23f; }

/* ---------- desktop sizes (docs/ux-tablet-review) ---------- */
/* windows up to ~1480px wide: the centred dialogue box ran into the menu dock (bottom right) and hid its first icons;
   it is centred in the room left of the dock instead */
@media (min-width: 901px) and (max-width: 1480px) {
  html:not(.touch) .dlg.dlg-box:not(.dlg-compact) { left: calc((calc(100 * var(--uvw, 1vw)) - 468px) / 2); max-width: min(560px, calc(calc(100 * var(--uvw, 1vw)) - 500px)); }
}
/* big windows (1080p and up): panels grow with the room instead of staying a 1040 x 720 card in the middle */
@media (min-width: 1600px) and (min-height: 1000px) {
  html:not(.touch) .modal { width: min(1240px, calc(calc(100 * var(--uvw, 1vw)) - 64px)); max-height: calc(calc(100 * var(--uvh, 1vh)) - 80px); }
  html:not(.touch) .modal.size-md { width: min(840px, calc(calc(100 * var(--uvw, 1vw)) - 64px)); }
  html:not(.touch) .modal.size-sm { width: min(540px, calc(calc(100 * var(--uvw, 1vw)) - 64px)); }
  html:not(.touch) .modal.size-lg, html:not(.touch) .modal.tall { height: min(880px, calc(calc(100 * var(--uvh, 1vh)) - 80px)); }
  html:not(.touch) .modal.size-lg.pk-panel { width: min(1320px, calc(calc(100 * var(--uvw, 1vw)) - 64px)); height: min(920px, calc(calc(100 * var(--uvh, 1vh)) - 80px)); }
  html:not(.touch) .tcx-panel.modal.size-md { width: min(880px, calc(calc(100 * var(--uvw, 1vw)) - 64px)); }
}
/* Mall highlight dots: a bigger target round the small dot */
.ml-dots button { position: relative; }
.ml-dots button::after { content: ''; position: absolute; inset: -8px -2px; }

/* ---------------------------------------------------------------- Pokémon stickers in the chat (js/chatstickers.js) */
#chat-form button.chat-stk { font-size: 17px; line-height: 1; }
#chat-form button.chat-stk[hidden] { display: none; }
.stk { position: relative; display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; margin: -6px 2px; }
.stk img { width: 30px; height: 30px; border-radius: 8px; image-rendering: pixelated; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
.stk-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0 2px; }
.stk.big { margin: 0; }
.stk.big img { width: 80px; height: 80px; border-radius: 16px; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.stk.big .stk-t { margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: rgba(10, 18, 40, .72); font: 900 11px Nunito, system-ui, sans-serif; color: #fff; white-space: nowrap; }
/* the motion that goes with the feeling (big stickers in the log and in the picker) */
.stk.big.fx-hop img, .stk-pick:hover .fx-hop img { animation: stk-hop 1.1s ease-in-out infinite; }
.stk.big.fx-beat img, .stk-pick:hover .fx-beat img { animation: stk-beat 1s ease-in-out infinite; }
.stk.big.fx-shake img, .stk-pick:hover .fx-shake img { animation: stk-shake .5s ease-in-out infinite; }
.stk.big.fx-sob img, .stk-pick:hover .fx-sob img { animation: stk-sob 1.3s ease-in-out infinite; }
.stk.big.fx-wobble img, .stk-pick:hover .fx-wobble img { animation: stk-wobble 1.4s ease-in-out infinite; }
.stk.big.fx-breathe img, .stk-pick:hover .fx-breathe img { animation: stk-breathe 2.4s ease-in-out infinite; }
.stk.big.fx-sway img, .stk-pick:hover .fx-sway img { animation: stk-sway 1.6s ease-in-out infinite; }
.stk.big.fx-pop img, .stk-pick:hover .fx-pop img { animation: stk-pop 1.2s ease-in-out infinite; }
.stk.big.fx-float img, .stk-pick:hover .fx-float img { animation: stk-float 2s ease-in-out infinite; }
@keyframes stk-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px); } 45% { transform: translateY(0) scaleY(.92); } }
@keyframes stk-beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.12); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes stk-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px) rotate(-3deg); } 75% { transform: translateX(3px) rotate(3deg); } }
@keyframes stk-sob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px) scaleY(.96); } }
@keyframes stk-wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes stk-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04, .97); } }
@keyframes stk-sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes stk-pop { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.18); } }
@keyframes stk-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
html.reduce-motion .stk img { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .stk img { animation: none !important; } }
/* (in the sheet everything scrolls together: Tail Crew emojis, the emoji row, GIFs, stickers and the credits) */
.stk-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 4px 2px 8px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat-sheet > .stk-grid { flex: 1 1 auto; min-height: 92px; }
/* one scroll for the whole picker (js/chat.js openStickers), nothing pinned below it */
.chat-sheet > .stk-scroll { flex: 1 1 auto; min-height: 92px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.stk-scroll .stk-grid { overflow: visible; }
.stk-sub { margin: 2px 4px 2px; font: 900 11px Nunito, system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #ffd84d; }
/* the GIFs are game sprites: no frame, pixel-sharp, their own shape (and they move by themselves) */
/* every GIF at one scale of its own pixels (--w, --h: js/chatstickers.js GIFS), so all the Pokémon match in size */
.stk.gif img { width: calc(var(--w) * .36px); height: calc(var(--h) * .36px); object-fit: contain; border-radius: 0; box-shadow: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5)); animation: none !important; }
.stk.big.gif img { width: calc(var(--w) * 1px); height: calc(var(--h) * 1px); border: 0; border-radius: 0; box-shadow: none; }
.stk-pick .stk.gif img { width: calc(var(--w) * .6px); height: calc(var(--h) * .6px); border-radius: 0; }
.stk-grid.gifs .stk-pick { justify-content: flex-end; min-height: 108px; min-width: 0; overflow: hidden; }
.stk-grid.gifs .stk-pick .stk.gif img { max-width: 100%; }
/* Tail Crew emojis (js/chatemojis.js): our own renders, smooth (not pixel art), their own shape with a white sticker edge */
.stk.emo img { width: 26px; height: 26px; border-radius: 0; box-shadow: none; image-rendering: auto; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35)); }
.stk.big.emo img { width: 72px; height: 72px; border: 0; border-radius: 0; box-shadow: none; }
.stk-grid.emos { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.stk-grid.emos .stk-pick { padding: 2px 0; min-width: 0; border-radius: 9px; }
.stk-pick .stk.emo img { width: 100%; max-width: 36px; height: auto; aspect-ratio: 1; border-radius: 0; }
.stk-pick { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .06); cursor: pointer; color: #fff; }
.stk-pick:hover, .stk-pick:focus-visible { background: rgba(255, 210, 63, .16); border-color: rgba(255, 210, 63, .5); }
.stk-pick:active { transform: scale(.94); }
.stk-pick .stk { margin: 0; }
.stk-pick .stk img { width: 52px; height: 52px; border-radius: 12px; }
.stk-pick small { font: 800 10.5px Nunito, system-ui, sans-serif; color: #d8e2ff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-emoji { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding: 6px 2px 8px; justify-items: center; }   /* the 12 emojis: two rows, right under the Tail Crew emojis */
.stk-emoji button { width: 100%; }
.stk-emoji button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .06); font-size: 20px; cursor: pointer; }
.stk-emoji button:active { transform: scale(.9); }
.stk-credit { margin: 4px 2px 6px; font: 700 9.5px/1.3 Nunito, system-ui, sans-serif; color: rgba(216, 226, 255, .55); }

/* the round chat button's word (shown where the button stands in for the whole chat: battles, cutscenes: chatscene.css) */
.cb-label { display: none; }
/* the desktop quick ball switch (js/hudextras.js; shown and placed by desktop.css), the Mall offer chip and the quest fold */
#ball-swap, .pf-promo, .qw-head { display: none; }
