/* Realm Wars, styled after Realm Idle: near-black surfaces, rounded cards,
 * purple primary actions, gold currency, green success. */
:root {
  --bg: #0a0a12;
  --bg2: #12121c;
  --card: #1a1a28;
  --card2: #222234;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --dim: #888;
  --muted: #b0b0b0;
  --green: #4ade80;
  --red: #ef4444;
  --blue: #60a5fa;
  --gold: #fbbf24;
  --purple: #a78bfa;
  --purple-deep: #7c3aed;
  --grad-purple: linear-gradient(135deg, #7c5cff, #6d28d9);
  /* Edge-to-edge: the SafeArea plugin sets --safe-area-inset-* natively in
   * the Android app; browsers fall back to env(). */
  --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* Block image drag/save and text selection/copy (game UI); inputs stay editable. */
body { -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; }
img { -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}
.hidden { display: none !important; }
img { image-rendering: pixelated; }
button { font-family: inherit; }

/* Scrollbars hidden everywhere (scroll still works) for a clean app-like look. */
* { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------- loading overlay (Realm Idle style) ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.load-overlay {
  position: fixed; inset: 0; z-index: 99998;
  /* Same hero-art backdrop as the auth screen, fully opaque, so loading is one
     cohesive screen (art + spinner) instead of a spinner over faint art. */
  background-color: var(--auth-fill, #0a0a12);
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, .74) 0%, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .92) 100%),
    var(--auth-img, none);
  background-repeat: no-repeat, no-repeat;
  background-position: center top, center bottom;
  background-size: cover, cover;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 12px; padding-top: calc(11vh + var(--safe-top, 0px));
}
.load-spinner {
  width: 44px; height: 44px; border: 4px solid #7c3aed; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.load-title { color: #c4b5fd; font-size: 16px; font-weight: 600; }
.load-sub { color: #6d5fa0; font-size: 12px; }

/* ---------- auth ---------- */
/* Login art (Realm Idle style): a random hero backdrop anchored bottom-center,
   with the sign-in card floating near the top. --auth-img / --auth-fill /
   --accent are set per-visit by the theme picker script in index.html. */
.auth-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: calc(7vh + var(--safe-top)) calc(16px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(16px + var(--safe-left));
  background-color: var(--auth-fill, #0a0a12);
  background-image:
    linear-gradient(to bottom, rgba(0, 0, 0, .74) 0%, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .92) 100%),
    var(--auth-img, none);
  background-repeat: no-repeat, no-repeat;
  background-position: center top, center bottom;
  background-size: cover, cover;
}
/* Wide / landscape screens (desktop): show the WHOLE hero art, centered, with the
   dark fill as side bars, instead of cropping it to cover. Portrait / phone keeps
   cover so it still fills edge to edge. Applies to the loading overlay and the
   sign-in screen (they share the same backdrop). */
@media (min-aspect-ratio: 1/1) {
  .load-overlay, .auth-screen { background-size: cover, contain; }
}
.auth-box {
  width: 340px; max-width: calc(100vw - 32px); padding: 32px 26px;
  background: rgba(14, 14, 22, .72);
  border: 1px solid rgba(255, 255, 255, .10); border-radius: 20px; text-align: center;
  box-shadow: 0 16px 60px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.logo { font-size: 40px; font-weight: 800; letter-spacing: 1px; color: #ffffff; }
.logo span { color: var(--accent, var(--purple)); }
.logo-small { font-weight: 800; font-size: 16px; color: #fff; white-space: nowrap; }
.logo-small span { color: var(--purple); }
.tagline { color: var(--muted); margin: 8px 0 26px; }
.google-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  display: inline-flex; transition: transform .06s, box-shadow .12s, filter .12s;
  border-radius: 10px;
}
.google-btn img { height: 52px; width: auto; image-rendering: auto; display: block; border-radius: 10px; }
.google-btn:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .35); filter: brightness(1.03); }
.google-btn:active { transform: translateY(1px); }
.auth-error { color: var(--red); min-height: 18px; margin-top: 12px; font-size: 13px; }
.auth-note { color: var(--dim); font-size: 11px; margin-top: 14px; }
.auth-note a { color: var(--muted); text-decoration: underline; }
.pick-label { color: var(--text); font-weight: 600; margin-bottom: 10px; }
#namePicker input {
  width: 100%; padding: 12px; margin-bottom: 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--text);
  font-size: 15px; text-align: center;
}
#namePicker input:focus { outline: none; border-color: var(--purple-deep); }

/* ---------- buttons ---------- */
.btn {
  min-height: 42px; padding: 10px 16px;
  background: var(--card2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: filter .12s, background .12s, border-color .12s, transform .05s;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { filter: brightness(1.2); border-color: var(--purple); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn-gold {
  background: var(--grad-purple); border: none; color: #fff; font-weight: 700;
  box-shadow: 0 2px 12px rgba(124, 92, 255, .35);
}
.btn-gold:hover:not(:disabled) { background: linear-gradient(135deg, #8b6fff, #7c3aed); }
.btn-mini { min-height: 34px; padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
/* Semantic variants: danger (red) for destructive, good (green) for friendly. */
.btn-danger { border-color: #7a3030; color: #ff9d9d; background: rgba(150, 55, 55, .12); }
.btn-danger:hover:not(:disabled) { background: rgba(150, 55, 55, .24); border-color: #a04545; }
.btn-good { border-color: #2f6b40; color: #86efac; background: rgba(45, 120, 65, .12); }
.btn-good:hover:not(:disabled) { background: rgba(45, 120, 65, .24); border-color: #3f8f56; }
/* A small cost/detail tag that rides inside a button, dimmer than the label. */
.btn .bcost { opacity: .82; font-weight: 500; }
select.btn { appearance: auto; }

/* ---------- layout ---------- */
.game { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--border);
  padding-top: calc(10px + var(--safe-top));
  padding-left: calc(14px + var(--safe-left));
  padding-right: calc(14px + var(--safe-right));
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.player-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hdr-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.hdr-name img.hdr-weapon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
.rank-div { font-size: 11px; color: var(--dim); font-weight: 700; margin-left: 3px; vertical-align: 2px; letter-spacing: .5px; }
.xpbar { position: relative; width: 170px; height: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.xpbar-fill { height: 100%; background: linear-gradient(90deg, #7c3aed, #a78bfa); width: 0%; transition: width .3s; }
.xpbar-label { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 14px; color: #fff; text-shadow: 0 1px 2px #000; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.currency { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.currency img { width: 16px; height: 16px; }
.currency.gold b { color: var(--gold); }
.currency.dia b { color: var(--blue); }
.currency b { font-weight: 700; }

.tabs {
  display: flex; gap: 6px; padding: 8px 10px; background: var(--bg2);
  border-bottom: 1px solid var(--border); overflow-x: auto;
  position: sticky; top: calc(57px + var(--safe-top)); z-index: 19;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 14px; cursor: pointer; color: var(--muted);
  border: 1px solid transparent; border-radius: 999px; white-space: nowrap; font-size: 13px;
  display: flex; gap: 6px; align-items: center; background: transparent;
}
.tab img { width: 17px; height: 17px; }
.tab:hover { color: var(--text); background: var(--card); }
.tab.active { background: var(--card); color: #fff; border-color: var(--purple-deep); }

.content {
  flex: 1; padding: 16px; max-width: 1100px; width: 100%; margin: 0 auto;
  padding-bottom: calc(24px + var(--safe-bottom));
  padding-left: calc(16px + var(--safe-left));
  padding-right: calc(16px + var(--safe-right));
}
.toasts { bottom: calc(16px + var(--safe-bottom)) !important; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 16px; margin-bottom: 10px; color: #fff; display: flex; align-items: center; gap: 8px; }
.panel h2 img { width: 20px; height: 20px; }
.muted { color: var(--muted); font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ---------- forge ---------- */
.forge-slot {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px; margin-bottom: 10px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.forge-item-icon {
  width: 52px; height: 52px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 20px; color: var(--purple);
}
.forge-item-icon img { width: 42px; height: 42px; }
.forge-mid { flex: 1; min-width: 150px; }
.progressbar { height: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; position: relative; margin-top: 6px; }
.progressbar-fill { height: 100%; background: var(--grad-purple); width: 0%; }
.progressbar span { position: absolute; inset: 0; text-align: center; font-size: 10px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px #000; }
.btn-collect {
  background: var(--purple-deep); color: #fff; border: none;
  border-radius: 999px; min-height: 34px; padding: 6px 14px; font-size: 12px; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 10px rgba(124, 58, 237, .35);
  transition: filter .12s, transform .05s;
}
.btn-collect:hover { filter: brightness(1.1); }
.btn-collect:active { transform: translateY(1px); }

/* ---------- items / inventory ---------- */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.tier-row + .tier-row { margin-top: 6px; }
/* Fight-modal loadout comparison + shared tactical-stat readout */
.fs-side { flex: 1; min-width: 140px; }
.fs-head { display: flex; align-items: center; gap: 6px; }
.fs-power { color: var(--gold); font-size: 15px; white-space: nowrap; }
.fs-core { font-size: 11px; margin-bottom: 3px; }
.tac-line { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 10px; line-height: 1.5; margin-bottom: 5px; }
.tac-stat { white-space: nowrap; color: var(--text); }
.tac-l { color: var(--muted); }
.item-cell {
  position: relative; background: var(--bg2); border: 2px solid var(--border); border-radius: 12px;
  padding: 6px 4px 3px; text-align: center; cursor: pointer; transition: transform .08s;
}
.item-cell:hover { transform: scale(1.05); z-index: 2; }
.item-cell img { width: 40px; height: 40px; }
.item-cell .qty { position: absolute; top: 2px; right: 4px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; }
.item-cell .nm { font-size: 9px; line-height: 1.15; display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.item-cell.locked { opacity: .35; filter: grayscale(.8); cursor: default; }

/* equipment doll */
.equip-wrap { display: flex; gap: 18px; flex-wrap: wrap; }
.equip-grid { display: grid; grid-template-columns: repeat(4, 74px); gap: 8px; }
.equip-slot {
  width: 74px; height: 86px; background: var(--bg2); border: 2px solid #3d3d4f;
  border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-size: 9px; color: var(--dim); text-align: center; gap: 2px;
}
.equip-slot img { width: 40px; height: 40px; }
.equip-slot.filled { border-style: solid; }
.stat-list { font-size: 13px; line-height: 1.9; min-width: 170px; }
.stat-list b { color: #fff; }
/* Grouped, separated sections in the equipment stat list. */
.stat-sec { padding: 7px 0; }
.stat-list .stat-sec { line-height: 1.75; }
.stat-list .stat-sec + .stat-sec { border-top: 1px solid var(--border); }

/* ---------- combat ---------- */
.zone-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.zone-tab { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer; font-size: 12px; color: var(--muted); background: var(--bg2); }
.zone-tab.active { color: #fff; border-color: var(--purple-deep); background: var(--card2); }
.zone-tab.locked { opacity: .4; cursor: default; }
/* Inventory filter (Melee..All): keep all on one line, scroll if a phone is too
   narrow, instead of wrapping. Gets its own row so it doesn't fight the Sort control. */
.inv-filter-tabs { flex: 1 1 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.inv-filter-tabs::-webkit-scrollbar { display: none; }
.inv-filter-tabs .zone-tab { flex: 0 0 auto; padding: 6px 10px; }
/* Real tabs (underline style) for the chat hub - one window, tabs on top. */
.chat-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab { flex: 0 0 auto; padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.chat-tab.active { color: #fff; border-bottom-color: var(--purple-deep); font-weight: 600; }
/* Small circled "i" that reveals the moderation/report note on hover (desktop)
   or tap (mobile, via toast) so it does not clutter the intro line. */
.chat-info { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 6px; border-radius: 50%; border: 1px solid currentColor; font-size: 10px; font-style: italic; line-height: 1; font-family: Georgia, 'Times New Roman', serif; opacity: .5; cursor: pointer; vertical-align: middle; }
.chat-info:hover { opacity: .9; }
/* ---------- World Boss ---------- */
.nav-timer { display: block; font-size: 10px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.di-txt { display: inline-flex; flex-direction: column; line-height: 1.15; }
.wb-head { display: flex; gap: 14px; align-items: flex-start; }
.wb-art { width: 96px; height: 96px; flex: 0 0 auto; border-radius: 12px; object-fit: contain; border: 1px solid var(--purple-deep); box-shadow: 0 0 16px rgba(255, 51, 0, .25); background: #180008; }
.wb-art.wb-dead { filter: grayscale(1) brightness(.6); box-shadow: none; }
.wb-info { flex: 1 1 auto; min-width: 0; }
.wb-hp .progressbar-fill { background: linear-gradient(90deg, #ff3300, #8b0000); }
.wb-slain { color: #ff3300; font-weight: 800; font-size: 12px; letter-spacing: .5px; }
.wb-done { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(124, 58, 237, .12); border: 1px solid var(--border); font-size: 13px; }
.wb-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.wb-piece { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); }
.wb-piece img { width: 40px; height: 40px; object-fit: contain; }
.wb-piece span { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; }
.wb-result { text-align: center; }
.wb-result .wb-art { width: 110px; height: 110px; margin: 0 auto; }
.wb-feed { display: flex; flex-direction: column; gap: 6px; }
.wb-drop { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); font-size: 13px; }
.wb-drop img { width: 28px; height: 28px; object-fit: contain; flex: 0 0 auto; }
/* ---------- guild perk pills + custom number stepper ---------- */
.guild-perks { font-size: 12px; color: var(--muted); }
.perk-pill { display: inline-block; background: var(--bg2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 11px; font-weight: 700; margin: 2px 2px 0 0; }
.num-stepper { position: relative; display: inline-flex; vertical-align: middle; }
.num-stepper > input[type=number] { width: 100%; -moz-appearance: textfield; padding-right: 22px; }
.num-stepper > input[type=number]::-webkit-inner-spin-button,
.num-stepper > input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.num-arrows { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 15px; display: flex; flex-direction: column; gap: 1px; }
.num-arrows button { flex: 1; border: none; background: var(--card2); color: var(--muted); cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 3px; line-height: 0; }
.num-arrows button:hover { background: var(--purple-deep); color: #fff; }
/* Combat zone picker: a wrapping grid so all zones show at once, no side-scroll. */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.zone-grid .zone-tab { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-tab-pts { display: inline-block; min-width: 15px; padding: 0 4px; border-radius: 8px; background: var(--card2); font-size: 10px; color: var(--gold); vertical-align: 1px; }
.monster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.monster-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 10px; text-align: center;
  position: relative;
}
.monster-card img.mimg { width: 72px; height: 72px; }
.monster-card.boss { border-color: var(--purple-deep); box-shadow: 0 0 14px rgba(124, 58, 237, .25) inset; }
.monster-card.locked { opacity: .45; filter: grayscale(.85); }
.monster-name { font-weight: 600; font-size: 13px; margin: 4px 0 2px; }
.mstat { font-size: 11px; color: var(--muted); }
.cls-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; padding: 1px 8px; border-radius: 999px; background: var(--card2); }
.cls-badge img { width: 12px; height: 12px; }
.kills-line { font-size: 10px; color: var(--dim); margin: 4px 0; }
.boss-tag { position: absolute; top: 6px; left: 6px; background: var(--purple-deep); color: #fff; font-size: 9px; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.monster-card .row { margin-top: 4px; }
.monster-card .row .btn {
  flex: 1; width: auto; margin-top: 0; min-height: 36px; max-height: 36px;
  padding: 8px 4px; border-radius: 10px; font-size: 13px;
}
.monster-card.autofighting { border-color: var(--green); box-shadow: 0 0 12px rgba(74, 222, 128, .2) inset; }

/* combat log */
.fight-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.fighter { text-align: center; flex: 1; }
.fighter img { width: 64px; height: 64px; }
.hpbar { height: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.hpbar-fill { height: 100%; background: linear-gradient(90deg, #16a34a, #4ade80); transition: width .15s; }
.vs { font-size: 20px; font-weight: 800; color: var(--purple); }
.fight-log {
  max-height: 220px; overflow-y: auto; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px;
  font-size: 12px; line-height: 1.7;
  scrollbar-color: var(--purple-deep) transparent;
}
.fight-log::-webkit-scrollbar-track { background: transparent; }
.fight-log::-webkit-scrollbar-thumb { border-color: var(--bg2); }
/* Simultaneous-combat log: your blows | round | their blows, side by side. */
.fight-round { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.fight-round-h { padding: 0 4px 6px; font-size: 11px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.fr-side { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.fr-me { justify-content: flex-end; }
.fr-foe { justify-content: flex-start; }
.fr-n { width: 22px; text-align: center; color: var(--dim); font-size: 11px; flex-shrink: 0; }
.fr-hit { white-space: nowrap; font-variant-numeric: tabular-nums; }
.fr-hit b { font-size: 9px; letter-spacing: .3px; }
.fight-result { text-align: center; font-size: 20px; font-weight: 800; margin: 10px 0 4px; }
.fight-result.win { color: var(--green); }
.fight-result.loss { color: var(--red); }
.reward-line { text-align: center; font-size: 13px; }

/* ---------- skill tree ---------- */
.st-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.st-pointpill {
  background: var(--grad-purple); color: #fff; font-weight: 800; font-size: 16px;
  padding: 4px 14px; border-radius: 999px;
}
.st-pointpill span { font-size: 11px; font-weight: 500; opacity: .85; }
.st-branches { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.st-branch {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px; border-top: 3px solid var(--bc); position: relative;
}
/* Prerequisite links drawn as an SVG overlay behind the node tiles. */
.st-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.st-branch-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-weight: 700; font-size: 15px; color: #fff;
}
.st-branch-head img { width: 22px; height: 22px; }
.st-spent { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--bc); }
/* Tier rows flow downward; nodes in a tier sit side by side, so prerequisites
   read top-to-bottom like a real tree. A connector line joins the tiers. */
.st-tier {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px;
  position: relative; margin-bottom: 16px; z-index: 1;
}
.st-node {
  background: var(--bg2); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 8px; cursor: pointer; transition: border-color .12s, transform .06s;
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  position: relative; z-index: 1;
}
.st-node:hover { transform: translateY(-1px); }
.st-node-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.st-node-top img { width: 26px; height: 26px; flex-shrink: 0; }
.st-node-name { font-size: 12px; font-weight: 700; line-height: 1.15; }
.st-scope { display: inline-block; margin-top: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.st-node-desc { font-size: 10px; color: var(--muted); line-height: 1.3; min-height: 26px; }
.st-node-foot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.st-pips { display: flex; gap: 3px; flex: 1; min-width: 0; overflow: hidden; }
.st-pips span { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.st-pips span.on { background: var(--bc); }
.st-bar { flex: 1; min-width: 0; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.st-bar div { height: 100%; background: var(--bc); }
.st-rank { font-size: 10px; color: var(--dim); white-space: nowrap; }
.st-plus {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card2); color: var(--dim); font-size: 18px; font-weight: 700; cursor: default;
  flex-shrink: 0; padding: 0; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.st-plus.on { background: var(--grad-purple); color: #fff; border: none; cursor: pointer; }
.st-node.st-active { border-color: var(--bc); }
.st-node.st-maxed { border-color: var(--gold); box-shadow: 0 0 8px rgba(251, 191, 36, .2) inset; }
/* Dim locked nodes with a filter (not opacity) so they stay OPAQUE and fully
   cover the prerequisite lines behind them instead of letting them bleed through. */
.st-node.st-locked { filter: brightness(.62) grayscale(.35); }
.st-node.st-locked .st-node-desc { color: var(--red); }

/* ---------- pvp / leaderboard / guild tables ---------- */
/* Wide tables scroll horizontally on a phone instead of clipping their action
   buttons off-screen (the page hides horizontal overflow). Every table.list is
   rendered inside one of these wrappers. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.list td { padding: 8px; border-bottom: 1px solid rgba(42, 42, 58, .5); }
table.list tr:hover td { background: rgba(255, 255, 255, .02); }
.rank-badge { width: 26px; height: 26px; vertical-align: middle; }
.tag { color: var(--purple); font-size: 11px; }
.pvp-topline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pvp-topline img { width: 52px; height: 52px; }
.rank-bar { height: 6px; background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin: 5px 0 2px; max-width: 240px; }
.rank-bar > div { height: 100%; background: var(--grad-purple); border-radius: 4px; transition: width .3s; }
tr.opp-rival td { background: rgba(239, 68, 68, .10); }
tr.opp-ally td { background: rgba(74, 222, 128, .08); }

/* ---------- shop ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.shop-grid .shop-card .btn { width: 100%; }
.shop-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 16px; text-align: center; }
.shop-card h3 { font-size: 14px; margin-bottom: 4px; }
.shop-price { color: var(--gold); font-weight: 700; margin: 8px 0; }
.owned { color: var(--green); font-weight: 700; }
.boost-active { border-color: var(--green); }
/* Pet shop: compact cards so several fit per row on mobile instead of one. */
.pet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.pet-grid .shop-card { padding: 10px 7px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pet-grid .shop-card img { width: 40px; height: 40px; }
.pet-grid .shop-card h3 { font-size: 12px; margin: 2px 0 0; line-height: 1.15; }
.pet-grid .pet-desc { font-size: 10px; line-height: 1.2; color: var(--muted); }
.pet-grid .shop-price { font-size: 11px; margin: 5px 0; }
.pet-grid .shop-card .btn { min-height: 30px; padding: 5px 8px; font-size: 12px; width: 100%; }
.pet-grid .owned { font-size: 11px; margin-top: 4px; }
/* Line up shop/pet cards: flex column with the price + Buy pushed to the bottom, so all
   buttons sit on the same line regardless of description length. */
.shop-card { display: flex; flex-direction: column; }
.shop-card .shop-price { margin-top: auto; }
.shop-card .btn { width: 100%; }
/* Diamond packs: always three across on one balanced row (instead of wrapping
   2 + 1), with a slightly smaller title so the names sit on one line at normal
   widths and wrap gracefully only on very narrow phones. */
.dia-grid { grid-template-columns: repeat(3, 1fr); }
.dia-grid .shop-card { padding: 16px 10px; }
.dia-grid .shop-card h3 { font-size: 13px; }
.shop-note {
  background: var(--bg2); border: 1px solid var(--purple-deep); border-radius: 12px;
  padding: 10px 14px; font-size: 12px; color: var(--muted); margin-top: 12px;
}

/* ---------- class builds (Gear tab) ---------- */
.class-builds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.class-build { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.class-build.active { border-color: var(--purple-deep); box-shadow: 0 0 10px rgba(124, 92, 255, .18) inset; }
.cb-head { display: flex; align-items: center; gap: 7px; font-size: 14px; flex-wrap: wrap; }
.cb-head img { width: 18px; height: 18px; }
.cb-now { position: absolute; top: 8px; right: 8px; font-size: 9px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--purple); background: rgba(124, 92, 255, .15); padding: 2px 6px; border-radius: 6px; }
.rename-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg2); color: var(--text); font-size: 15px; box-sizing: border-box; }
.rename-input:focus { outline: none; border-color: var(--purple); }
.acct-name { margin-bottom: 12px; }
.acct-grid { display: flex; flex-direction: column; gap: 6px; }
.acct-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 11px; background: var(--bg2); border-radius: 8px; font-size: 13px; }
.acct-row > span:first-child { flex-shrink: 0; }
.acct-row > span:last-child { text-align: right; word-break: break-word; }
.acct-footer { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.acct-footer a { color: var(--muted); text-decoration: none; }
.acct-footer a:hover { color: var(--purple); text-decoration: underline; }
.cb-power { margin: 6px 0 2px; font-size: 13px; }
.cb-stats { font-size: 11px; margin: 3px 0; }
.cb-stats > div { display: flex; justify-content: space-between; color: var(--muted); padding: 1px 0; }
.cb-stats b { color: var(--text); font-weight: 700; }
.cb-tac { margin-top: 5px; }
.cb-def { font-size: 10px; margin-top: 4px; }
.cb-equip { width: 100%; margin-top: auto; }
.cb-equip:disabled { opacity: .55; cursor: default; }
.class-build.active .cb-equip:disabled { color: var(--purple); border-color: var(--purple-deep); }
.forge-stats { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12px; align-items: baseline; max-width: 320px; }
.forge-stats .fs-l { color: var(--muted); }
/* Leaderboard: fixed columns so name/Lv/value stay put across the three types. */
.lb-table { table-layout: fixed; }
.lb-table .lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.build-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; margin: 6px 0 14px; }
.build-pick { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; text-align: left; cursor: pointer; font-weight: 700; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.build-pick .muted { font-weight: 400; font-size: 10px; }
.build-pick:hover { border-color: var(--purple); }
/* Auto-equip: Best+Custom on one row, the three styles on the next row. */
.autoeq-col { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- pvp opponents (cards) ---------- */
.opp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.opp-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.opp-card.opp-rival { border-color: rgba(239, 68, 68, .5); }
.opp-card.opp-ally { border-color: rgba(74, 222, 128, .4); }
.opp-top { display: flex; align-items: center; gap: 10px; }
.opp-top .rank-badge { width: 34px; height: 34px; flex-shrink: 0; }
.opp-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.opp-stats b { color: var(--text); }
.opp-actions { display: flex; gap: 8px; }
.opp-actions .btn { min-height: 38px; }
.inspect-line { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.inspect-line img { width: 18px; height: 18px; }
.stat-info { display: flex; flex-direction: column; gap: 9px; }
.stat-info-row { display: flex; flex-direction: column; gap: 1px; }
.stat-info-row b { font-size: 13px; }
.stat-info-row .muted { font-size: 12px; line-height: 1.35; }
.help-sec { border-top: 1px solid var(--border); padding-top: 9px; margin-top: 9px; }
.help-h { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.tri-line { text-align: center; font-weight: 700; color: var(--text); margin-top: 6px; letter-spacing: .5px; }
.builds-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.builds-table th { text-align: left; color: var(--dim); font-weight: 600; font-size: 10.5px; padding: 5px 7px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.builds-table td { padding: 6px 7px; border-bottom: 1px solid rgba(42, 42, 58, .5); white-space: nowrap; }
.build-tbl-h { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #fff; margin: 14px 0 4px; font-size: 13px; }
.build-tbl-h img { width: 16px; height: 16px; }

/* ---------- quests & achievements ---------- */
.quest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 8px; }
.quest-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.quest-card.quest-ready { border-color: var(--gold); box-shadow: 0 0 10px rgba(251, 191, 36, .18) inset; }
.quest-card.quest-done { opacity: .55; }
.nav-badge { margin-left: auto; background: var(--gold); color: #1a1400; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.nav-badge.alert { background: #ef4444; color: #fff; }

/* ---------- modal & toasts ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 5, 10, .78); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 20px; width: 100%; max-width: 460px; max-height: 86dvh; overflow-y: auto;
  box-shadow: 0 18px 80px rgba(0, 0, 0, .7);
}
.modal-box h2 { margin-bottom: 10px; font-size: 16px; }
.modal-close { float: right; cursor: pointer; color: var(--dim); font-size: 18px; }
/* Stripe embedded checkout (web only): the card form mounts inside the modal. */
.stripe-modal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
#stripeEmbed { min-height: 220px; }
/* Slot swap picker (tap a gear slot to change gear) */
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin-top: 4px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg2); cursor: pointer; }
.pick-row:hover { border-color: var(--purple); }
.pick-row img { width: 36px; height: 36px; flex-shrink: 0; }
.toasts { position: fixed; bottom: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--card2); border: 1px solid var(--border); border-left: 3px solid var(--purple);
  color: var(--text); border-radius: 12px; padding: 10px 14px; font-size: 13px; max-width: min(320px, calc(100vw - 32px));
  animation: toastIn .2s ease; box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}
.toast.err { border-left-color: var(--red); }
.toast.good { border-left-color: var(--green); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- rarity text (tiers 8+ animate, same gradients as Realm Idle) ---------- */
@keyframes waveText { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
[class*="rarity-text-"] { font-weight: 700; }
.rarity-text-8,.rarity-text-9,.rarity-text-10,.rarity-text-11,.rarity-text-12,.rarity-text-13,.rarity-text-14,
.rarity-text-15,.rarity-text-16,.rarity-text-17,.rarity-text-18,.rarity-text-19,.rarity-text-20,.rarity-text-21 {
  -webkit-background-clip: text !important; background-clip: text !important;
  -webkit-text-fill-color: transparent !important; background-size: 200% 100% !important;
  animation: waveText 5s linear infinite !important;
}
.rarity-text-8{background-image:linear-gradient(90deg,#8b4500,#cc6600,#ff8c1a,#cc6600,#8b4500,#cc6600,#ff8c1a,#cc6600,#8b4500)!important}
.rarity-text-9{background-image:linear-gradient(90deg,#4d0099,#6600cc,#8533ff,#6600cc,#4d0099,#6600cc,#8533ff,#6600cc,#4d0099)!important}
.rarity-text-10{background-image:linear-gradient(90deg,#990050,#cc0066,#ff1a8c,#cc0066,#990050,#cc0066,#ff1a8c,#cc0066,#990050)!important}
.rarity-text-11{background-image:linear-gradient(90deg,#009973,#00cc99,#1affe6,#00cc99,#009973,#00cc99,#1affe6,#00cc99,#009973)!important}
.rarity-text-12{background-image:linear-gradient(90deg,#6666a6,#9999cc,#ccccff,#9999cc,#6666a6,#9999cc,#ccccff,#9999cc,#6666a6)!important}
.rarity-text-13{background-image:linear-gradient(90deg,#2d2d45,#4a4a6e,#6767a0,#4a4a6e,#2d2d45,#4a4a6e,#6767a0,#4a4a6e,#2d2d45)!important}
.rarity-text-14{background-image:linear-gradient(90deg,#cc2600,#ff3300,#ff6633,#ff3300,#cc2600,#ff3300,#ff6633,#ff3300,#cc2600)!important}
.rarity-text-15{background-image:linear-gradient(90deg,#ccaa00,#FFD700,#fff4aa,#FFD700,#ccaa00,#FFD700,#fff4aa,#FFD700,#ccaa00)!important}
.rarity-text-16{background-image:linear-gradient(90deg,#6640cc,#9966ff,#cc99ff,#9966ff,#6640cc,#9966ff,#cc99ff,#9966ff,#6640cc)!important}
.rarity-text-17{background-image:linear-gradient(90deg,#cccccc,#ffffff,#eeeeee,#ffffff,#cccccc,#ffffff,#eeeeee,#ffffff,#cccccc)!important}
.rarity-text-18{background-image:linear-gradient(90deg,#e6e699,#ffffcc,#ffffee,#ffffcc,#e6e699,#ffffcc,#ffffee,#ffffcc,#e6e699)!important}
.rarity-text-19{background-image:linear-gradient(90deg,#6699cc,#99ccff,#cceeff,#99ccff,#6699cc,#99ccff,#cceeff,#99ccff,#6699cc)!important}
.rarity-text-20{background-image:linear-gradient(90deg,#ff66ff,#ff99ff,#ffccff,#99ffff,#66ffff,#ff99ff,#ffccff,#99ffff,#ff66ff)!important}
.rarity-text-21{background-image:linear-gradient(90deg,#00997a,#7fffd4,#e8ffd9,#ffd700,#b388ff,#7fffd4,#40e0d0,#ffd700,#00997a)!important}

/* ---------- item quality, affixes, pets ---------- */
.inv-head { margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px; }
.filter-row { row-gap: 8px; }
.affix-box {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-top: 12px; font-size: 13px; line-height: 1.8;
}
.affix { color: var(--green); }
.compare-box {
  background: var(--bg2); border: 1px dashed var(--border); border-radius: 12px;
  padding: 10px 14px; margin-top: 12px; font-size: 13px; line-height: 1.8;
}
.up-arrow { position: absolute; top: 2px; left: 5px; color: var(--green); font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px #000; }
.item-cell .qty { font-weight: 700; }
.pet-active { border-color: var(--green) !important; box-shadow: 0 0 10px rgba(74, 222, 128, .35); }
@keyframes giftPulse { 0%, 100% { box-shadow: 0 0 4px rgba(251, 191, 36, .5); } 50% { box-shadow: 0 0 14px rgba(251, 191, 36, .9); } }
.daily-ready { border-color: var(--gold) !important; animation: giftPulse 1.6s ease-in-out infinite; }

/* ---------- VIP gradient text (from Realm Idle) ---------- */
@keyframes vipGradient { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.vip-text, .vipp-text, .vip-gold {
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: vipGradient 4s linear infinite; font-weight: 800;
}
.vip-gold { background-image: linear-gradient(90deg, #fde68a, #fbbf24, #f59e0b, #fbbf24, #fde68a); }
.vip-text { background-image: linear-gradient(90deg, #a78bfa, #7c3aed, #d4d4d4, #f5f5f5, #d4d4d4, #7c3aed, #a78bfa); }
.vipp-text { background-image: linear-gradient(90deg, #fbbf24, #f59e0b, #a78bfa, #7c3aed, #a78bfa, #f59e0b, #fbbf24); }

/* ---------- sidebar nav (desktop) / slide-in drawer (mobile) ---------- */
.game-row { display: flex; min-height: 100vh; align-items: stretch; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-btn { display: inline-flex; font-size: 16px; }
.sidebar {
  width: 212px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border);
  padding: calc(16px + var(--safe-top)) 12px calc(16px + var(--safe-bottom)) calc(12px + var(--safe-left));
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  transition: margin-left .16s ease;
}
body.nav-collapsed .sidebar { margin-left: -213px; }
.nav-scrim { display: none; }
.drawer-logo { font-size: 20px; font-weight: 800; color: #fff; margin: 0 8px 14px; }
.drawer-logo span { color: var(--purple); }
.drawer-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; color: var(--muted); cursor: pointer; font-size: 15px;
}
.drawer-item img { width: 20px; height: 20px; }
.drawer-item.active { background: var(--card); color: #fff; border: 1px solid var(--purple-deep); }
.drawer-item:hover { background: var(--card2); }
.drawer-item svg { width: 20px; height: 20px; flex-shrink: 0; }
/* Button drawer items (Account, Sign out) get the same flat, transparent look as
   the nav items instead of the browser's default white button chrome. */
button.drawer-item { background: none; border: none; width: 100%; font: inherit; text-align: left; }
/* Account + Sign out pinned together at the bottom of the drawer (flex column). */
.drawer-account { margin-top: auto; }
.drawer-signout:hover { color: var(--red); }

.disc { color: var(--dim); font-size: .72em; font-weight: 400; }

/* skill ? marks */
.qmark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--dim);
  color: var(--dim); font-size: 10px; cursor: pointer; vertical-align: 1px;
}
.qmark:hover { color: var(--purple); border-color: var(--purple); }

/* custom dropdowns */
.picker { position: relative; display: inline-block; }
.picker-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  background: var(--card2); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; min-width: 150px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.picker-item { padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.picker-item:hover { background: var(--card); }
.picker-item.sells, .zone-tab.sells { background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .45); }
.picker-item.sel { outline: 1px solid var(--purple-deep); }
.sells-tag { color: var(--red); font-size: 10px; font-weight: 700; }

/* autofight status bar */
#autobar {
  position: fixed; bottom: calc(14px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; z-index: 35; box-sizing: border-box;
  background: var(--card2); border: 1px solid var(--green); border-radius: 14px;
  padding: 10px 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, .55);
  width: min(460px, calc(100vw - 20px));
}
#autobar img { width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px; }
.autobar-mid { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; flex: 1 1 auto; }
.autobar-mid > b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autobar-mid .muted { font-size: 11px; white-space: normal; line-height: 1.4; }
#autobar > .btn { flex-shrink: 0; }
.autobar-feed { font-size: 11px; line-height: 1.5; color: #94a3b8; }
.autobar-feed.win { color: var(--green); }
.autobar-feed.loss { color: #94a3b8; }
.autobar-feed.flash { animation: autobarFlash .45s ease-out; }
@keyframes autobarFlash { from { opacity: .3; } to { opacity: 1; } }
/* While the autofight bar is on screen, keep it from covering the last content
   row or the toasts (the bar is appended to <body> only while hunting). */
body:has(#autobar) .content { padding-bottom: calc(96px + var(--safe-bottom)); }
body:has(#autobar) .toasts { bottom: calc(92px + var(--safe-bottom)) !important; }
.fav-star { position: absolute; bottom: 14px; right: 4px; font-size: 11px; text-shadow: 0 1px 2px #000; }
.fav-dot {
  width: 26px; height: 26px; border-radius: 50%; display: inline-block; cursor: pointer;
  border: 2px solid transparent; vertical-align: middle;
}
.fav-dot.on { border-color: #fff; box-shadow: 0 0 6px rgba(255, 255, 255, .5); }
.token-line { font-size: 13px; }

/* guild chat */
.chat-box {
  max-height: 260px; overflow-y: auto; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px; font-size: 13px;
  display: flex; flex-direction: column; gap: 3px;
}
.chat-msg { display: flex; gap: 6px; align-items: baseline; padding: 2px 4px; border-radius: 6px; }
.chat-msg:hover { background: rgba(255, 255, 255, .02); }
.chat-msg:hover .chat-actions { opacity: 1; }
.chat-name { color: var(--purple); font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.chat-name .disc { font-size: .72em; }
.chat-text { color: var(--text); word-break: break-word; flex: 1; }
.chat-actions { opacity: 0; display: flex; gap: 6px; font-size: 11px; flex-shrink: 0; transition: opacity .12s; }
.chat-actions span { cursor: pointer; }
/* Touch devices have no hover, so always show the chat moderation actions there. */
@media (hover: none) { .chat-actions { opacity: 1; } }
.plink { cursor: pointer; }
.plink:hover { text-decoration: underline; text-decoration-color: var(--purple); }

/* ---- social hub: friends list + DM bubbles (scales to big lists) ---- */
.social-search { width: 100%; margin-bottom: 6px; }
.social-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 2px 5px; }
.social-head:first-child { margin-top: 2px; }
.social-head.req { color: var(--gold); }
.social-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--bg2); }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 11px; }
.friend-row + .friend-row { border-top: 1px solid var(--border); }
.friend-row:hover { background: rgba(255, 255, 255, .025); }
.friend-row .who { display: flex; align-items: center; gap: 7px; min-width: 0; cursor: pointer; }
.friend-row .who .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.friend-row .who .disc { font-size: .72em; flex-shrink: 0; }
.friend-row .acts { display: flex; gap: 5px; flex-shrink: 0; }
.social-empty { color: var(--muted); text-align: center; padding: 26px 8px; font-size: 13px; }
.pm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.pm-head b { font-size: 15px; }
.pm-thread { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; }
.pm-msg { display: flex; }
.pm-msg.me { justify-content: flex-end; }
.pm-bubble { max-width: 78%; padding: 7px 12px; border-radius: 15px; font-size: 13.5px; line-height: 1.4; word-break: break-word; }
.pm-msg.me .pm-bubble { background: var(--purple-deep); color: #fff; border-bottom-right-radius: 4px; }
.pm-msg.them .pm-bubble { background: var(--card2); color: var(--text); border-bottom-left-radius: 4px; }

@media (max-width: 720px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 46; height: 100dvh;
    margin-left: -232px; box-shadow: none;
  }
  body.nav-open .sidebar { margin-left: 0; box-shadow: 8px 0 40px rgba(0, 0, 0, .6); }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(5, 5, 10, .7); z-index: 45; }
}
@media (max-width: 640px) {
  /* Elastic XP bar + tighter spacing so the name/XP side and currency cluster
     share the narrow top bar without overlapping. */
  .topbar { gap: 8px; }
  .topbar-right { gap: 6px; }
  .player-id { flex: 1 1 auto; }
  .xpbar { width: 100%; min-width: 0; }
  .content { padding: 10px; padding-bottom: calc(24px + var(--safe-bottom)); }
  .equip-grid { grid-template-columns: repeat(4, 1fr); width: 100%; }
  .equip-slot { width: 100%; min-width: 0; }
  .modal-box { padding: 16px; }
  .logo-small { display: none; }
}
