/* 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; }
#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; }
.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); }
.nametag .title { font-size: 9px; color: #c8e7ff; font-weight: 600; }
.nametag.me .nm { color: #ffe36e; }
.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(100vh - 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(100vh - 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);
}
#money { flex-basis: 100%; text-align: right; }
#money, #cos-hud .cos-dia {
  display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end;
  background: var(--panel); border: 1px solid var(--line); color: var(--gold); font-weight: 900; border-radius: 999px; padding: 3px 10px; font-size: 13px;
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
#money { flex-basis: auto; margin-left: auto; }
#money .cur { opacity: .8; }
/* 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); }
.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/hud.js) ---------- */
#chat { position: absolute; z-index: 2; left: 12px; bottom: 12px; width: clamp(250px, calc(50vw - 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(100vh - 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 .ch-tag { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 5px; border-radius: 4px; background: var(--surface-2); font-size: 9px; font-weight: 900; font-style: normal; color: var(--muted); vertical-align: 1px; }
.msg b { font-style: normal; color: #ffe08a; }
.msg.sys { color: #c4d2f2; }
.msg.catch { color: #7dff9f; font-weight: 800; }
.msg.battle { color: #ffc4e6; }
.ch-Global { color: #9fe1ff; }
.ch-Trade { color: #ffd08a; }
#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 .ic { width: 18px; height: 18px; }

/* ---------- 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 {
  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; }
html:not(.touch) .mn-device { display: none; }
.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: 42px; height: 42px; }
.mi:hover { transform: translateY(-2px); }
.mi:active { transform: scale(.94); }
.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: 340px; max-height: calc(100vh - 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(4, 1fr); gap: 4px; }
.mn-grid .mi { display: flex; flex-direction: column; gap: 4px; padding: 8px 2px 6px; border-radius: 12px; min-height: 76px; }
.mn-grid .mi:hover { background: var(--surface); transform: none; }
.mn-grid .mi-label { font-size: 12px; 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); }

/* ---------- 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.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(100vw - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#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(50vw - 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) #money { font-size: 12px; padding: 2px 8px; }
  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-more { right: 50%; transform: translateX(50%); width: min(340px, calc(100vw - 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(50vw - 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((100vw - 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(100vw - 16px - 54px - 8px - 68px - 12px); }
  html:not(.touch) #chat[data-state="expanded"] { width: calc(100vw - 16px); }
  html:not(.touch) #chat-log { height: min(190px, 26vh); }
}
/* 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(100vw - 32px)); max-height: calc(100vh - 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(100vw - 32px)); }
/* no layout jump when switching tabs / views */
.modal.size-lg, .modal.tall { height: min(720px, calc(100vh - 40px)); }
.modal.size-lg .modal-body, .modal.tall .modal-body { flex: 1; }
.modal.size-sm { width: min(480px, calc(100vw - 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; }
.oak-intro { position: fixed; inset: 0; z-index: 6; background: radial-gradient(circle at 50% 40%, #2a3f7a, #050914 75%); transition: opacity .6s; }
.oak-intro.out { opacity: 0; }
.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(100vw - 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(100vw - 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(100vw - 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(100vw - 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: 64px 1fr; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; color: #c8e7ff; }
.cc-sw { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cc-sw button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #0a1630; background: var(--c); cursor: pointer; padding: 0; }
.cc-sw button.on { outline: 3px solid #ffcb05; }
.cc-sw input[type=color] { width: 30px; height: 26px; border: 0; background: none; padding: 0; cursor: pointer; }
.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; }
@media (max-width: 640px) { .cc-split { grid-template-columns: 1fr; } .cc-tcard canvas { max-height: 200px; } }
.oak-pic { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); width: 220px; height: 220px; }
.oak-pic img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .5)); }
.oak-skip { position: absolute; right: 18px; top: 18px; }
.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 { font-size: 26px; }
@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); } }
.starters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.starter { font: inherit; color: #fff; background: #13285a; border: 3px solid #2d5bb3; border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.starter img { width: 140px; height: 140px; object-fit: contain; background: radial-gradient(circle, color-mix(in srgb, var(--t) 45%, transparent), transparent 70%); border-radius: 50%; }
.starter b { font-size: 18px; }
.starter small { color: #c8e7ff; font-weight: 600; text-align: center; }
.starter.on { border-color: var(--t); box-shadow: 0 0 0 3px var(--t) inset, 0 0 20px color-mix(in srgb, var(--t) 50%, transparent); }
.starter-go { display: flex; justify-content: center; margin-top: 12px; }
.starter-go .btn { font-size: 18px; padding: 8px 30px; }
@media (max-width: 640px) { .starters { grid-template-columns: 1fr; } .starter img { width: 90px; height: 90px; } }

/* "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(100vw - 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; }
html.touch.portrait #hunt-chip { bottom: auto; top: calc(var(--sat, 0px) + 62px); max-width: calc(100vw - 200px - var(--sal, 0px) - var(--sar, 0px)); }
html.touch.landscape #hunt-chip { bottom: auto; top: calc(var(--sat, 0px) + 54px); max-width: 36vw; }

/* ---------- 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(100vw - 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(100vw - 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(100vw - 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: 100%; height: 100%; object-fit: contain; }
.chs-tag { align-self: start; font: 900 10.5px 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); }
.chs-empty { grid-template-columns: 64px 1fr; border-style: dashed; background: rgba(16, 30, 72, .45); }
.chs-empty .chs-plus { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font: 900 34px Nunito, sans-serif; color: #ffd23f; background: rgba(255, 210, 63, .12); }
.chs-empty b { display: block; font-size: 17px; }
.chs-empty small { color: #b9c8f0; font-weight: 800; }
.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; }
