/* Layout shells: lobby, game stage, HUD layers, modal frames */
/* Mobile: UI column max 497px (side fields); 3D canvas stays full-bleed. Wide ≥692px. */

.lobby {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  background: transparent !important;
  z-index: 6;
  overflow: hidden;
}

.lobby-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.menu-bobber {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  /* shows through while WebGL buffer is cleared on resize */
  background: #2a4548;
}

.lobby-shell {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  height: 100%;
  max-width: 497px;
  max-height: none;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(0.4rem, 1.2vh, 0.7rem);
  padding:
    max(0.55rem, var(--safe-t))
    max(0.55rem, var(--safe-r))
    max(0.55rem, var(--safe-b))
    max(0.55rem, var(--safe-l));
  overflow: hidden;
  pointer-events: none;
  animation: lobbyIn 0.45s ease-out both;
  box-sizing: border-box;
}

.lobby-body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-template-areas:
    "gap"
    "cur"
    "nav"
    "cta";
  gap: clamp(0.4rem, 1.2vh, 0.7rem);
  min-height: 0;
  min-width: 0;
  pointer-events: none;
}

/* Wrappers dissolve so children join lobby-body grid (mobile order ≠ DOM) */
.lobby-rail,
.lobby-hero {
  display: contents;
  pointer-events: none;
}

/* Only real chrome blocks the full-bleed bite layer */
.lobby-top,
.lobby-top-main,
.lobby-daily-btn,
.lobby-daily,
.lobby-mid-row,
.lobby-bottom-row,
.lobby #menu-error {
  pointer-events: auto;
}

/* Inline daily — ONLY roomy tablet/PC (>=801px). Narrower: button → modal */
.lobby-daily {
  display: none !important;
}

.lobby-mail-btn {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: auto !important;
  min-width: 40px !important;
  height: 40px !important;
  padding: 0 0.75rem 0 0.65rem !important;
  border-radius: 12px !important;
  font-weight: 800;
  font-size: 0.88rem;
  color: #fff;
  touch-action: manipulation;
}

.lobby-mail-label {
  display: none;
}

.lobby-mail-btn .lobby-ico {
  width: 1.25rem;
  height: 1.25rem;
}

.lobby-mail-btn .mail-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c45c26;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}

.lobby-stage-gap {
  grid-area: gap;
  pointer-events: none !important;
  min-height: clamp(4rem, 18vh, 8rem);
  min-width: 0;
  position: relative;
}

.lobby-daily-btn {
  position: relative;
  z-index: 2;
  grid-area: unset;
  touch-action: manipulation;
  align-self: flex-start;
  width: 4.75rem !important;
  height: 4.75rem !important;
  min-height: 4.75rem !important;
  min-width: 4.75rem !important;
  max-width: 4.75rem !important;
  aspect-ratio: 1;
  padding: 0.28rem 0.1rem 0.22rem !important;
  border-radius: 12px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  font-weight: 800;
  font-size: 0.58rem !important;
  line-height: 1.05;
  color: #eaf6f2;
}

.lobby-daily-btn-rail {
  display: none !important;
}

.lobby-daily-btn-mobile {
  display: flex !important;
}

.lobby-daily-btn-mobile .lobby-daily-ico {
  display: grid;
  place-items: center;
  width: 58%;
  max-width: 2.55rem;
  max-height: 62%;
  aspect-ratio: 1;
  height: auto;
  line-height: 0;
  flex: 0 0 auto;
  flex-shrink: 0;
}

.lobby-daily-ico svg,
.lobby-daily-ico img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lobby-daily-label {
  display: block;
  flex: 0 0 auto;
  font-size: inherit;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  margin-top: 0;
  line-height: 1.05;
  max-width: 100%;
  padding: 0 0.1rem;
}

.lobby-daily-btn .mail-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c45c26;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.lobby-daily-btn.has-claim {
  box-shadow: var(--morphism-up), 0 0 0 2px rgba(244, 194, 75, 0.55);
  border-color: var(--wizard-gold) !important;
}

/* Full-bleed bite layer under UI — shell is pointer-events:none, chrome catches clicks */
.bobber-hit {
  pointer-events: auto;
  position: absolute;
  z-index: 1;
  inset: 0;
  width: auto;
  height: auto;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

.lobby-top {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.55rem;
  min-width: 0;
}

.lobby-top-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lobby-identity-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.lobby-identity {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
}

.lobby-identity-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* Mirror .hud-identity sizes (avatar / name / XP plate) */
.lobby-identity-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.lobby-level-badge {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  width: 75px;
  height: 75px;
  border-radius: 0;
  display: grid;
  place-items: center;
  background: url('../assets/bg-bth-home.webp') center / 100% 100% no-repeat;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 1.38rem;
  font-weight: 900;
}

.lobby-avatar {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border-radius: 0;
  object-fit: cover;
  pointer-events: none;
}

.lobby-level-badge:not(.has-avatar)::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.35);
}

.lobby-identity-meta {
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.lobby-name-input {
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: 20rem;
  border: 0 !important;
  box-shadow: none !important;
  font-size: clamp(1.75rem, 3.2vw, 2.35rem) !important;
  line-height: 1.1 !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  caret-color: transparent;
}

.lobby-xp-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 10.5rem;
  max-width: 10.5rem;
}

.xp-bar-lobby {
  /* Same outer plate as .xp-bar-hud */
  flex: none;
  width: 10.5rem;
  max-width: 10.5rem;
  height: 1.85rem !important;
}

.lobby-xp-label {
  font-family: Fredoka, 'Arial Black', sans-serif;
  font-size: inherit;
  font-weight: inherit;
  font-style: italic;
  letter-spacing: inherit;
  color: inherit;
  -webkit-text-stroke: inherit;
  paint-order: inherit;
  text-shadow: none;
  white-space: nowrap;
  opacity: 0.95;
  margin-left: 0.25rem;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  line-height: 1;
}

.lobby-top-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.4rem;
  flex-shrink: 0;
  margin-left: auto;
}

.lobby-top-actions #btn-close-parent {
  order: 3;
}

.lobby-top-actions #btn-menu-settings {
  order: 2;
}

.lobby-top-actions #btn-mail-menu {
  order: 1;
}

/* Top menu — wood icon tiles (PC compact; mobile keeps 3.6rem in responsive.css) */
.lobby-icon-btn {
  position: relative;
  width: 3.4rem !important;
  height: 3.4rem !important;
  min-width: 3.4rem !important;
  padding: 0.18rem !important;
  border-radius: 0 !important;
  display: grid !important;
  place-items: center;
  touch-action: manipulation;
  overflow: visible;
}

.lobby-ico {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  line-height: 0;
}

.lobby-ico svg {
  width: 1.25rem;
  height: 1.25rem;
}

.lobby-icon-btn .mail-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c45c26;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  line-height: 1;
}

.lobby-announce {
  flex: 1 1 180px;
  min-width: 0;
  max-width: 28rem;
  padding: 0.35rem 0.7rem;
  border-radius: 10px;
  background: rgba(18, 52, 48, 0.82);
  border: 1px solid rgba(120, 210, 180, 0.35);
  color: #d8f3ea;
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(4, 16, 18, 0.82);
  backdrop-filter: blur(8px);
}
.maintenance-overlay.hidden { display: none; }
.maintenance-card {
  padding: 1.6rem 1.8rem;
  border-radius: 18px;
  background: #123532;
  border: 1px solid rgba(180, 220, 205, 0.3);
  color: #eaf6f2;
  text-align: center;
  max-width: 22rem;
}
.lobby-tile[disabled],
.lobby-cta[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

.lobby-currency {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 0.28rem;
  width: 100%;
  min-width: 11.5rem;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.lobby-cur {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  flex: 1 1 0;
  min-width: 0;
  padding: 0.28rem 0.4rem 0.28rem 0.32rem;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: url('../assets/bg-tag.webp') center / 100% 100% no-repeat;
  box-shadow: none;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  cursor: default;
  overflow: hidden;
}

.lobby-cur .cur-ico {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
}

.lobby-cur strong {
  margin-left: 0;
  padding-right: 0.5rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: #fff !important;
  min-width: 0;
  flex: 1 1 auto;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-cur-label {
  display: none;
}

.lobby-cur .cur-ico {
  width: 1.2rem;
  height: 1.2rem;
  display: grid;
  place-items: center;
  flex: 0 0 1.2rem;
  overflow: hidden;
}

.lobby-cur .cur-ico img,
.lobby-cur .cur-ico .ico,
.lobby-cur .cur-ico .ico-img,
.lobby-cur .cur-ico .ico img,
.lobby-cur .cur-ico .ico.ico-art,
.lobby-cur .cur-ico .ico.ico-art img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  font-size: inherit;
}

.lobby-level-vip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  gap: 0.08rem;
  line-height: 1;
}

.lobby-vip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  flex: 0 0 auto;
}

.lobby-vip.hidden {
  display: none;
}

.lobby-vip .ico,
.lobby-vip .ico-img {
  width: 100%;
  height: 100%;
}

.lobby-vip .ico-img {
  object-fit: contain;
}

.lobby-name-row {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.lobby-name-row .lobby-name-input {
  flex: 0 1 auto;
  min-width: 0;
}

.lobby-name-row .identity-level {
  line-height: 1;
  padding-bottom: 0.12em;
}

.lobby-level-vip .identity-level {
  padding-bottom: 0;
}

.lobby-cur.gold strong {
  color: #fff;
}

.lobby-cur.dia strong {
  color: #9fd4ff;
}

.lobby-cur.alny strong {
  color: var(--wizard-gold);
}

.lobby-mid-row {
  grid-area: nav;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  justify-items: stretch;
  align-items: end;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.lobby-tile {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: none;
  min-height: 4.75rem !important;
  height: 4.75rem !important;
  padding: 0.28rem 0.1rem 0.22rem !important;
  font-size: clamp(0.48rem, 2vw, 0.58rem) !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  white-space: normal !important;
  text-align: center;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  align-self: end;
  box-sizing: border-box;
  overflow: visible;
}

/* .lobby-tile display:flex !important beats bare .hidden — keep hide working */
.lobby-tile.hidden,
.lobby-tile[hidden] {
  display: none !important;
}

.lobby-tile > span:not(.mail-badge):not(.bz-lock-hint):not(.lobby-tile-caption),
.lobby-tile > .lobby-daily-label {
  flex: 0 0 auto;
  margin-top: 0;
  line-height: 1.05;
  max-width: 100%;
  padding: 0 0.1rem;
  position: relative;
  z-index: 1;
}

.lobby-tile-caption {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.2rem;
  flex: 0 0 auto;
  max-width: 100%;
  line-height: 1.05;
  position: relative;
  z-index: 1;
}

.lobby-tile.btn-locked > img {
  flex: 0 0 auto;
  width: 58%;
  max-width: 2.55rem;
  max-height: 62%;
  margin-inline: auto;
}

.lobby-tile .bz-lock-hint {
  position: static;
  display: inline;
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.85em;
  font-weight: 700;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
  white-space: nowrap;
}

.lobby-tile > img {
  width: 58%;
  max-width: 2.55rem;
  max-height: 62%;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
  min-height: 0;
}

/* Market art has more empty padding — slight upscale, keep caption room */
#btn-bazaar-menu > img,
#ico-bazaar,
#btn-bazaar-menu.btn-locked > img {
  width: 62% !important;
  max-width: 2.85rem !important;
  max-height: 58% !important;
  transform: scale(1.06);
  transform-origin: center center;
}

.lobby-bottom-row {
  grid-area: cta;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

.lobby-cta {
  flex: 1 1 0;
  min-width: 0;
  min-height: 4.85rem !important;
  font-size: clamp(0.82rem, 2.8vw, 0.98rem) !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 14px !important;
  padding-inline: 0.85rem !important;
  box-sizing: border-box;
}

.lobby-cta-ico {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  line-height: 0;
  flex: 0 0 auto;
}

.lobby-cta-ico svg,
.lobby-cta-ico img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lobby-cta-tourney .lobby-cta-ico {
  width: 1.95rem;
  height: 1.95rem;
}

.lobby-cta > span:not(.lobby-cta-ico) {
  flex: 0 1 auto;
  min-width: 0;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.lobby #menu-error {
  margin: 0;
  text-align: center;
}

.logo {
  margin: 0.15rem 0 !important;
  font-size: clamp(2.6rem, 11vw, 3.6rem) !important;
  letter-spacing: -0.02em;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-family: var(--font-brand) !important;
  font-weight: 700;
  color: #fff8e7;
}

.tagline {
  margin: 0 !important;
  opacity: 0.85;
  font-size: 0.95rem !important;
  color: var(--text-dim) !important;
}

.mode-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem !important;
  width: 100% !important;
}

.game {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
}

.stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#pond {
  display: block;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  /* Match stage — teal flash before first paint looked like a broken lake. */
  background: #0e1c1b;
}

/* Cover stage 16:9 (crop edges, no pillar/letterbox). Absolute center (not grid):
 * canvas.width attrs change intrinsic size and WebKit then collapses width:auto
 * into a thin strip — JS pins style px from .stage-world, never from canvas rect. */
.stage-world {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  background: #0e1c1b;
}

.stage-world #pond {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  width: auto;
  aspect-ratio: 16 / 9;
  max-width: none;
  max-height: none;
}

.walk-nudge {
  position: absolute;
  top: var(--pier-y, 28%);
  z-index: 4;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transform: translateY(-50%);
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.walk-nudge::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-top: 3px solid rgba(255, 255, 255, 0.92);
  border-right: 3px solid rgba(255, 255, 255, 0.92);
}

.walk-nudge-left {
  left: 0.55rem;
}

.walk-nudge-left::before {
  transform: translateX(2px) rotate(-135deg);
}

.walk-nudge-right {
  right: 0.55rem;
}

.walk-nudge-right::before {
  transform: translateX(-2px) rotate(45deg);
}

.walk-nudge:active {
  background: rgba(255, 255, 255, 0.38);
}

.big-catch {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: max(0.4rem, env(safe-area-inset-top, 0px)) max(0.4rem, env(safe-area-inset-right, 0px))
    max(0.4rem, env(safe-area-inset-bottom, 0px)) max(0.4rem, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  background: rgba(4, 10, 14, 0.55);
  pointer-events: auto;
  cursor: pointer;
}

.big-catch.hidden {
  display: none;
}

.big-catch-card {
  position: relative;
  width: fit-content;
  max-width: min(92vw, 28rem);
  max-height: min(90dvh, 90vh);
  pointer-events: none;
}

.big-catch-bg {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 28rem);
  max-height: min(90dvh, 90vh);
  object-fit: contain;
}

.big-catch-fish {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 52%;
  height: 34%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

.big-catch-label {
  position: absolute;
  left: 50%;
  bottom: 16%;
  width: 78%;
  transform: translateX(-50%);
  text-align: center;
  white-space: pre-line;
  font-weight: 900;
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
  color: #2a1608;
  -webkit-text-stroke: 1px #f6e7a8;
  text-shadow: 0 2px 0 #f3d56a, 0 4px 0 rgba(90, 40, 8, 0.35);
  pointer-events: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.hud-bottom-dock, .overlay-panel, .btn {
  pointer-events: auto;
}

/* Stats / leaderboard are display-only — let shore clicks pass through to canvas walk zone */
.hud-top,
.hud-stats,
.leaderboard {
  pointer-events: none;
}

.hud-top-actions,
.hud-top-actions .btn,
.chum-controls,
.chum-type-menu {
  pointer-events: auto;
}

.hud-top {
  position: absolute;
  top: var(--hud-pad);
  left: var(--hud-pad);
  right: var(--hud-pad);
  display: block;
}

.hud-stats {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem !important;
  max-width: calc(100% - 3.6rem);
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.hud-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}

.hud-identity {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 0 1 auto;
}

.hud-avatar-badge {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  width: 75px;
  height: 75px;
  border-radius: 14px;
  background: url('../assets/bg-bth-home.webp') center / 100% 100% no-repeat;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.hud-avatar {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border-radius: 10px;
  object-fit: cover;
}

.hud-avatar-badge:not(.has-avatar)::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
}

.hud-identity-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.hud-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.hud-player-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 20rem;
}

.hud-currencies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.hud-top-actions {
  /* Outside .hud-head — absolute so it never stretches identity */
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: end;
  justify-items: end;
  align-items: start;
  gap: 0.35rem;
  margin: 0;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.hud-top-actions #btn-daily-game {
  order: 1;
}

.hud-top-actions #btn-game-settings {
  order: 2;
}

.hud-top-actions #btn-leave {
  order: 3;
}

/* Room online — under action buttons, right-aligned (map .lz-online language). */
.hud-room-online {
  order: 4;
  grid-column: 1 / -1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  line-height: 1;
  pointer-events: none;
  margin-top: 0.1rem;
}

.hud-room-online-dot {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #3dce6a;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 0 5px rgba(61, 206, 106, 0.55);
  flex: 0 0 auto;
}

.hud-room-online-n {
  font-family: Fredoka, 'Arial Black', sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  color: #e8ffe8;
  -webkit-text-stroke: 1.2px #111;
  paint-order: stroke fill;
  min-width: 0.6em;
  line-height: 1;
}

.leaderboard {
  position: absolute;
  top: calc(var(--hud-pad) + 5.5rem);
  left: var(--hud-pad);
  min-width: min(160px, 42%);
  max-width: 46%;
  background: rgba(12, 18, 18, 0.78);
  border: 2px solid #0c0c0c;
  border-radius: 10px;
  padding: 0.4rem 0.55rem !important;
  font-size: clamp(0.75rem, 2.2vw, 0.85rem);
  color: var(--text) !important;
}

.leaderboard .row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.12rem 0;
}

.leaderboard .row.you {
  color: #ffd166;
}

.hud-bottom-dock {
  position: absolute;
  left: var(--hud-pad);
  right: var(--hud-pad);
  bottom: var(--hud-pad);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  z-index: 12;
  pointer-events: none;
}

.hud-bottom-dock > * {
  pointer-events: auto;
}

.hud-bottom-tools {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
}

.hud-bottom-tools .chum-controls {
  margin-left: auto;
  flex-shrink: 0;
}

.overlay-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100% - 1.5rem));
  max-height: min(80dvh, 560px);
  overflow: auto;
  background: var(--glass-strong) !important;
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 16px 40px var(--shadow);
  z-index: 5;
  color: var(--text);
}

.overlay-panel h2 {
  margin: 0 0 0.75rem;
}

.overlay-panel ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.overlay-panel li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-top {
  display: flex;
  justify-content: flex-end;
  width: 100% !important;
}

.mode-row.stacked {
  flex-direction: column;
  gap: 0.55rem;
  width: 100% !important;
}

.mode-row.stacked .btn {
  width: 100%;
}

.profile-card {
  width: 100% !important;
  margin: 0.6rem 0 1rem;
  padding: 0.9rem 1rem !important;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-stats {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: #e8fff8;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.profile-level-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.map-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background-color: #2a1a0e !important;
  background-image: url('../assets/grid-platform.webp') !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  z-index: 7 !important;
  align-items: center;
  overflow: hidden;
  padding: max(8px, var(--safe-t)) max(8px, var(--safe-r)) max(8px, var(--safe-b)) max(8px, var(--safe-l));
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  touch-action: none;
}

.map-wrap.inv-panel-platform {
  padding: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
  gap: 0 !important;
}

.map-wrap.inv-panel-platform > .map-chrome {
  position: absolute !important;
  top: calc(var(--plat-edge, 14px) + 0.45rem);
  right: calc(var(--plat-edge, 14px) + 0.45rem);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
}

.map-chrome > * {
  pointer-events: auto;
}

.map-close-btn {
  margin: 0;
}

.map-wrap.inv-panel-platform > .map-viewport {
  position: absolute !important;
  inset: var(--plat-edge, 14px);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  border-radius: 0;
  z-index: 1;
}

.map-viewport.is-panning {
  cursor: grabbing;
}

.map-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-world picture,
.map-world img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.map-polys {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  overflow: visible;
  pointer-events: auto;
}

.map-polys .map-poly {
  pointer-events: auto;
  cursor: pointer;
  fill: rgba(40, 130, 150, 0.28);
  stroke: rgba(180, 240, 250, 0.85);
  stroke-width: 2;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 0.12s ease, stroke 0.12s ease, opacity 0.12s ease;
}

.map-polys .map-poly:hover,
.map-polys .map-poly.is-hover {
  fill: rgba(60, 170, 150, 0.42);
  stroke: rgba(200, 255, 230, 0.95);
  stroke-width: 2.4;
}

.map-polys .map-poly.open {
  fill: rgba(40, 170, 130, 0.4);
  stroke: rgba(140, 255, 200, 0.95);
  stroke-width: 2.4;
  filter: drop-shadow(0 0 2px rgba(100, 255, 180, 0.35));
}

.map-polys .map-poly.open.premium {
  fill: rgba(220, 170, 50, 0.38);
  stroke: rgba(255, 225, 120, 0.95);
}

.map-polys .map-poly.locked {
  fill: rgba(70, 85, 100, 0.32);
  stroke: rgba(190, 205, 220, 0.8);
  cursor: pointer;
  opacity: 1;
}

.map-polys .map-poly.locked-premium {
  fill: rgba(140, 105, 35, 0.34);
  stroke: rgba(240, 200, 100, 0.85);
  cursor: pointer;
}

.map-polys .map-poly.coming-soon {
  fill: rgba(90, 100, 115, 0.3);
  stroke: rgba(175, 190, 210, 0.78);
  opacity: 1;
  cursor: pointer;
}


.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(4, 18, 16, 0.72) !important;
  padding: 1rem;
  backdrop-filter: blur(6px);
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: linear-gradient(180deg,#1a2420,#0d1210);
  color: #f2f7f4;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  width: min(440px,94vw);
  max-height: min(86vh,640px);
  overflow: auto;
  font-family: var(--font-ui);
}

.modal-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  margin-bottom: 0.65rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.55rem;
}

.modal-head h2 {
  margin: 0;
}

.inv-panel {
  width: min(760px, 96vw) !important;
  max-height: min(90vh, 760px) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.55rem !important;
  overflow: hidden;
  min-height: 0;
}

.inv-shell {
  width: min(840px, 96vw);
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  position: relative;
}

.inv-shell > .inv-panel {
  width: 100% !important;
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
}

.inv-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 0.7rem;
  align-items: stretch;
}

.inv-main > .inv-panel {
  width: 100% !important;
  max-height: none !important;
  min-height: 0;
  height: 100%;
}

.inv-main > .inv-detail {
  align-self: start;
  height: fit-content;
  min-height: 0;
  max-height: 100%;
}

.inv-chrome {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  min-width: 0;
}

.inv-chrome-title {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.inv-chrome-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.inv-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0;
  padding: 0.4rem 0.95rem 0.4rem 0.55rem;
  min-height: 2.75rem;
  min-width: 6.5rem;
  border-radius: 12px;
  background: url('../assets/bg-inventory-count.webp') center / 100% 100% no-repeat;
  border: none;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  box-sizing: border-box;
}

.inv-count-ico {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  filter: brightness(0) invert(1);
}

.inv-count-ico .ico,
.inv-count-ico svg {
  width: 100% !important;
  height: 100% !important;
}

.inv-close {
  margin-left: 0;
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 0;
  background: url('../assets/btn-close.webp') center / contain no-repeat;
  cursor: pointer;
  flex-shrink: 0;
}

.inv-desk-bar {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
}

.inv-desk-bar .inv-filters {
  display: flex;
  flex: 1 1 auto;
  gap: 0.3rem;
  margin: 0;
  min-width: 0;
  width: auto;
}

.inv-desk-bar .inv-filters .chip {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 2.45rem;
  padding: 0 0.35rem;
  border: none !important;
  border-radius: 12px !important;
  background: url('../assets/bg-tab.webp') center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  color: #fff !important;
  font-weight: 800;
  font-size: 0.82rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  filter: grayscale(0.55) brightness(0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-desk-bar .inv-filters .chip.active {
  filter: brightness(1.18) saturate(1.15);
  box-shadow: none !important;
  outline: none !important;
}

.inv-desk-sort {
  flex: 0 0 8.5rem;
  margin: 0;
  background: url('../assets/bg-tab.webp') center / 100% 100% no-repeat;
  border-radius: 12px;
  padding: 0 0.15rem;
  min-width: 0;
}

.inv-desk-sort .inv-sort,
#inventory-modal .inv-desk-sort .inv-sort {
  width: 100%;
  height: 2.45rem;
  min-height: 2.45rem;
  margin: 0;
  padding: 0 1.6rem 0 0.65rem !important;
  border: none !important;
  border-radius: 12px !important;
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath fill='%23fff' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.55rem center !important;
  background-size: 10px 7px !important;
  box-shadow: none !important;
  color: #fff !important;
  font-weight: 800;
  font-size: 0.82rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none !important;
}

.inv-desk-action {
  flex: 0 0 auto;
  min-width: 6.5rem;
  min-height: 2.45rem;
  padding: 0 0.75rem;
  border: none !important;
  border-radius: 12px !important;
  background: url('../assets/bg-price.webp') center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  color: #fff !important;
  font-weight: 800;
  font-size: 0.82rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  cursor: pointer;
  white-space: nowrap;
}

.inv-desk-action-rotten {
  filter: grayscale(0.35) sepia(0.35) hue-rotate(-20deg) saturate(1.4);
}

/* Mass sell/discard — keep in DOM, hide UI */
#btn-sell-junk,
#btn-discard-spoiled,
#btn-sell-junk-m,
#btn-discard-spoiled-m,
#inv-actions-btn {
  display: none !important;
}

.inv-mobile-only {
  display: none !important;
}

.inv-actions-pop {
  position: absolute;
  right: 0.4rem;
  top: 4.5rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 11rem;
  padding: 0.55rem;
  border-radius: 12px;
  background: rgba(20, 12, 8, 0.94);
  border: 1px solid rgba(200, 160, 100, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.inv-actions-pop.hidden {
  display: none !important;
}

.inv-actions-pop-btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #f4efe6;
  text-align: left;
}

.inv-actions-pop-danger {
  color: #ffb4a8;
}

.inv-actions-pop-cancel {
  opacity: 0.75;
  text-align: center;
}

.inv-panel-platform {
  --plat-edge: 14px;
  --plat-corner: 28px;
  position: relative;
  z-index: 0;
  padding: calc(var(--plat-edge) + 0.5rem) !important;
  gap: 0.45rem !important;
  color: #f0e6d4 !important;
  background-color: #2a1a0e !important;
  background-image: url('../assets/grid-platform.webp') !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
}

.inv-plat-frame {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.inv-plat-edge {
  position: absolute;
  overflow: hidden;
}

.inv-plat-edge-l,
.inv-plat-edge-r {
  top: calc(var(--plat-corner) * 0.42);
  bottom: calc(var(--plat-corner) * 0.42);
  width: var(--plat-edge);
  background: url('../assets/border-grid-platform.webp') center / 100% 100% no-repeat;
}

.inv-plat-edge-l { left: 0; }
.inv-plat-edge-r {
  right: 0;
  transform: scaleX(-1);
}

.inv-plat-edge-t,
.inv-plat-edge-b {
  left: calc(var(--plat-corner) * 0.42);
  right: calc(var(--plat-corner) * 0.42);
  height: var(--plat-edge);
}

.inv-plat-edge-t { top: 0; }
.inv-plat-edge-b { bottom: 0; }

.inv-plat-edge-t::before,
.inv-plat-edge-b::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--plat-edge);
  height: 2400px;
  background: url('../assets/border-grid-platform.webp') center / 100% 100% no-repeat;
  transform: translate(-50%, -50%) rotate(90deg);
}

.inv-plat-edge-b::before {
  transform: translate(-50%, -50%) rotate(90deg) scaleY(-1);
}

.inv-plat-corner {
  --plat-corner-inset: -2px;
  position: absolute;
  width: calc(var(--plat-corner) * 1.2);
  height: calc(var(--plat-corner) * 1.2);
  background: url('../assets/angle-platform.webp') center / contain no-repeat;
  z-index: 1;
}

/* Asset is drawn as top-right corner (outer edges top+right). */
.inv-plat-tr {
  top: var(--plat-corner-inset);
  right: var(--plat-corner-inset);
}
.inv-plat-tl {
  top: var(--plat-corner-inset);
  left: var(--plat-corner-inset);
  transform: scaleX(-1);
}
.inv-plat-br {
  bottom: var(--plat-corner-inset);
  right: var(--plat-corner-inset);
  transform: scaleY(-1);
}
.inv-plat-bl {
  bottom: var(--plat-corner-inset);
  left: var(--plat-corner-inset);
  transform: scale(-1);
}

.inv-panel-platform > *:not(.inv-plat-frame) {
  position: relative;
  z-index: 1;
}

.inv-panel > .modal-head,
.inv-panel > .inv-filters,
.inv-panel > .inv-desk-bar {
  flex-shrink: 0;
}

.inv-panel .modal-head {
  align-items: center;
}

.inv-panel .inv-slots {
  margin: 0;
}

.modal-card, .inv-panel, .bazaar-card, .tourney-results, .profile-card {
  box-shadow: 6px 6px 16px var(--neo-dark),
  -4px -4px 12px var(--neo-light);
}

.inv-panel-platform.modal-card,
.inv-panel.inv-panel-platform,
.modal-card.inv-panel-platform {
  background-color: #2a1a0e !important;
  background-image: url('../assets/grid-platform.webp') !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55) !important;
}

.hud-gear {
  display: none !important;
}

.hud-gear-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35) !important;
  box-shadow: none !important;
  font-size: 0.85rem;
  border: 1px solid var(--stroke) !important;
  color: var(--text);
}

.inv-panel.panel-neo, .tackle-card.panel-neo {
  background: linear-gradient(165deg, #1e322e 0%, #121a18 55%, #0c1210 100%) !important;
  color: #e8f4f0 !important;
  border: 1px solid rgba(160, 210, 195, 0.22);
  overflow: hidden;
}

.modal-head-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
  flex: 1;
}

.inv-body {
  display: block !important;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.inv-body .inv-grid {
  height: 100%;
}

.lobby-bg {
  display: none;
}

.lobby-brand {
  text-align: center;
  padding: 0.25rem 0 0.15rem;
}

.brand-mark {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(240, 220, 140, 0.85);
  font-weight: 800;
}

.mode-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.mode-secondary .btn {
  font-size: 0.88rem !important;
  min-height: 42px !important;
  padding: 0.55rem 0.6rem !important;
}

.mode-secondary .btn-tile:nth-child(5) {
  grid-column: 1 / -1;
}

.bestiary-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 0.7rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.bestiary-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.bestiary-tabs .chip {
  width: 100%;
  min-height: 2.45rem;
  border: none !important;
  border-radius: 12px !important;
  padding: 0.35rem 0.45rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: url('../assets/bg-tab.webp') center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  color: #fff !important;
  font-weight: 800;
  font-size: 0.88rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  opacity: 0.72;
  filter: grayscale(0.25) brightness(0.88);
}

.bestiary-tabs .chip.active {
  opacity: 1;
  filter: none;
}

#bestiary-modal .inv-m-search {
  display: block;
  width: 100%;
  min-width: 0;
  background: url('../assets/bg-search.webp') center / 100% 100% no-repeat;
  border-radius: 12px;
  padding: 0.1rem 0.35rem;
  min-height: 2.4rem;
}

#bestiary-modal .inv-m-search input {
  width: 100%;
  height: 2.2rem;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #f4efe6 !important;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 2.2rem 0 0.75rem !important;
  outline: none !important;
}

#bestiary-modal .inv-m-search input::placeholder {
  color: rgba(244, 239, 230, 0.55);
}

#bestiary-modal .inv-shell {
  width: min(1200px, 97vw);
  max-height: min(92vh, 900px);
}

/* Don't filter the whole slot — it breaks mobile grid paint/overflow. */
#bestiary-modal .inv-slot.locked {
  opacity: 0.7;
}

#bestiary-modal .inv-slot.locked .inv-slot-fish-art,
#bestiary-modal .inv-slot.locked .inv-slot-grid,
#bestiary-modal .inv-slot.locked .inv-slot-ico {
  filter: brightness(0) opacity(0.5);
}

/* Same containment as inventory: portraits must not inflate grid rows. */
#bestiary-modal .inv-slot {
  overflow: hidden;
}

#bestiary-modal .inv-slot-fish .inv-slot-grid,
#bestiary-modal .inv-slot-fish .inv-slot-fish-art {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}

#bestiary-modal .inv-slot-fish::before {
  display: none;
}

#bestiary-modal .inv-slot-fish .inv-slot-fish-art {
  filter: none;
}

@media (max-width: 900px) {
  .bestiary-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    grid-template-columns: none;
  }

  .bestiary-tabs {
    width: 100%;
    flex: none;
  }

  #bestiary-modal .inv-m-search {
    width: 100%;
    flex: none;
  }

  /* Same 3 equal reserved cols as desktop — detail sheet is wide enough. */
  #bestiary-modal .bestiary-bait-cols {
    gap: 0.35rem;
  }

  #bestiary-modal .bestiary-bait-col-title {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: 0.12rem 0.4rem;
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.5);
    width: fit-content;
    font-size: 0.72rem;
  }

  #bestiary-modal .bestiary-bait-list {
    gap: 0.3rem;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    grid-auto-flow: row;
  }

  #bestiary-modal .bestiary-bait-tile.inv-slot,
  #bestiary-modal .bestiary-bait-tile,
  #bestiary-modal .bestiary-bait-slot {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    flex: none !important;
    justify-self: stretch !important;
  }

  #bestiary-modal .inv-main {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: visible !important;
    min-height: 0 !important;
  }

  #bestiary-modal .inv-main > .inv-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    align-self: stretch !important;
    overflow: visible !important;
  }

  #bestiary-modal .inv-main > .inv-detail {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    flex: none !important;
    align-self: auto !important;
    z-index: 6 !important;
  }

  /* Grow with open «Детали» — no inner scroll (grid spacer tracks height). */
  #bestiary-modal .inv-detail-body,
  #bestiary-modal .inv-main > .inv-detail .inv-detail-body {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
  }

  #bestiary-modal .inv-grid,
  #inventory-modal .inv-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-rows: max-content !important;
    align-content: start !important;
  }

  #bestiary-modal .inv-slot,
  #inventory-modal .inv-slot {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: unset !important;
    align-self: start !important;
    justify-self: stretch !important;
    overflow: hidden !important;
  }

  #bestiary-modal .inv-slot-fish {
    overflow: hidden !important;
  }

  /* Mobile: collapsed details only — summary visible, never auto-open. */
  #bestiary-modal .bestiary-more > summary {
    display: flex !important;
  }
}

@media (min-width: 901px) {
  #bestiary-modal .inv-main {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
    grid-template-rows: auto;
    align-items: start;
    height: 520px;
    min-height: 520px;
    max-height: 520px;
    overflow: visible;
  }

  #bestiary-modal .inv-main > .inv-panel {
    height: fit-content;
    max-height: none;
    min-height: 0;
    align-self: start;
    overflow: hidden;
  }

  #bestiary-modal .inv-main > .inv-detail,
  #bestiary-modal .inv-main > .inv-detail.inv-panel-platform {
    height: fit-content !important;
    max-height: none !important;
    min-height: 0;
    align-self: start;
    overflow: visible !important;
  }

  #bestiary-modal .inv-main > .inv-detail .inv-detail-body {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #bestiary-modal .inv-grid {
    max-height: none !important;
    height: auto !important;
  }

  #bestiary-modal .bestiary-bait-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    grid-auto-flow: row;
    align-content: start;
    width: 100%;
    height: fit-content;
  }

  #bestiary-modal .bestiary-more > summary {
    display: none;
  }

  #bestiary-modal .bestiary-more > :not(summary) {
    margin-top: 0;
  }
}

.bestiary-more {
  margin-top: 0.35rem;
  min-width: 0;
}

.bestiary-more > summary {
  list-style: none;
  cursor: pointer;
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0 0.9rem;
  border-radius: 12px;
  background: url('../assets/bg-tab.webp') center / 100% 100% no-repeat;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  user-select: none;
}

.bestiary-more > summary::-webkit-details-marker {
  display: none;
}

.bestiary-more > summary::after {
  content: '▾';
  font-size: 0.85rem;
  opacity: 0.85;
}

.bestiary-more[open] > summary::after {
  content: '▴';
}

.bestiary-more > :not(summary) {
  margin-top: 0.55rem;
}

.hud-stats .stat {
  background: url('../assets/bg-tag.webp') center / 100% 100% no-repeat;
  border: none;
  border-radius: 999px;
  padding: 0.28rem 0.95rem 0.28rem 0.55rem;
  min-width: 5.6rem;
  align-items: center;
  color: #fff;
  box-shadow: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hud-stats .label {
  opacity: 0.7;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hud-stats .stat-cur {
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

#hud-caps { color: #fff; }
#hud-timeon { color: #9fd4ff; }
#hud-alny { color: var(--wizard-gold, #f0d78c); }

.hud-stats .stat-cur .label {
  opacity: 1;
  font-size: 1em;
  text-transform: none;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 1.15rem;
}

.hud-stats .stat-cur .label img,
.hud-stats .stat-cur .label .ico,
.hud-stats .stat-cur .label .ico img,
.hud-stats .stat-cur .label .ico svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.hud-stats .stat-cur .ico svg {
  width: 1.1em;
  height: 1.1em;
}

.hud-wood-btn.neo-btn {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 4.1rem !important;
  min-height: 4.1rem !important;
  width: 4.1rem !important;
  padding: 0.3rem 0.25rem 0.35rem !important;
  border: none !important;
  border-radius: 0 !important;
  background: url('../assets/bg-bth-home.webp') center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: #fff !important;
  font-size: 0.62rem !important;
  font-weight: 800 !important;
  line-height: 1.05 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

/* PC: top corner actions smaller than bottom dock wood buttons */
.hud-top-actions .hud-wood-btn.neo-btn,
.hud-top-actions .hud-wood-btn,
.hud-top-actions .hud-wood-btn-icon {
  min-width: 3.4rem !important;
  width: 3.4rem !important;
  min-height: 3.4rem !important;
  height: 3.4rem !important;
  padding: 0.18rem !important;
  font-size: 0.48rem !important;
  overflow: visible;
}

.hud-top-actions .hud-wood-ico,
.hud-top-actions .hud-wood-btn-icon .hud-wood-ico {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hud-wood-btn::before {
  display: none !important;
}

.hud-wood-btn-icon {
  min-width: 3.15rem !important;
  width: 3.15rem !important;
  min-height: 3.15rem !important;
  padding: 0.25rem !important;
}

.hud-wood-ico {
  width: 1.85rem;
  height: 1.85rem;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.hud-wood-btn-icon .hud-wood-ico {
  width: 2.15rem;
  height: 2.15rem;
}

.hud-wood-btn span[data-i18n] {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-card h2, .modal-head h2 {
  font-family: var(--font-brand) !important;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tackle-card > .modal-head {
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 0.4rem;
}

.tackle-card > .modal-head h2 {
  flex-shrink: 0;
  white-space: nowrap;
}

.bazaar-card, .tourney-results, .craft-card, #mail-modal .modal-card {
  width: min(640px, 96vw);
  color: var(--text) !important;
}

.mode-row.stacked .btn-hero, .mode-row.stacked .btn-mode {
  width: 100%;
}

.hud-gear-slot .ico svg {
  filter: brightness(1.15);
}

#premium-modal .modal-card,
#mail-modal .modal-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Fit mail count; tall only when many items (scroll #mail-body). */
#mail-modal {
  align-items: center;
  justify-items: center;
}

#mail-modal .modal-card {
  height: fit-content;
  max-height: min(86vh, 640px);
  width: min(420px, 94vw);
  overflow: hidden;
}

#mail-body {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#premium-modal .premium-card {
  width: min(380px, 92vw);
  color: var(--text) !important;
  padding: 0.85rem 1rem 1rem;
  gap: 0.55rem;
}

#premium-modal .modal-head.premium-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem !important;
  padding-bottom: 0.2rem;
  border-bottom: none;
  min-height: 2.35rem;
}

#premium-modal .premium-head .inv-close {
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
}

/* Same Lobster weight/size as .hud-player-name / .lobby-name-input */
#premium-modal .premium-head .inv-chrome-title {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Lobster', Georgia, serif !important;
  font-weight: 400 !important;
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  line-height: 1.1;
  -webkit-text-stroke: 0.65px #1a1008;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.55));
}

.hud-ping {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  opacity: 0.9;
  line-height: 1.2;
  white-space: nowrap;
}

.hud-ping.ok {
  color: #7dffa0;
}

.hud-ping.mid {
  color: #ffd76a;
}

.hud-ping.bad {
  color: #ff8a8a;
}

.hud-ping.off {
  color: rgba(255, 255, 255, 0.45);
}
