/* pixel-bright.css: Stage 2 — Bright Warm Xianxia Pixel UI Theme (Walnut Wood · Cream Parchment · Antique Gold · Jade)
 * Inspired by vankieptutien.online: clean, sunny, high-contrast readability across Lobby, Hub, Gacha, Boss, Create, Combat & Modals.
 */
:root {
  --ink: #70b8e8;
  --panel: #fbf3de;
  --panel2: #f3e5c4;
  --border: #b88a4a;
  --gold: #c98f28;
  --gold2: #7a4b10;
  --text: #382112;
  --muted: #6f523a;
  --jade: #1d8a64;
  --jade-dark: #156649;
  --red: #d43832;
  --wood-top: #74492b;
  --wood-bot: #4f2f1a;
  --wood-dark: #2c180c;
  --cream: #fcf5e3;
  --cream2: #efe0bd;
  --gold-rim: #e8be5e;
}

html,
body {
  background: #70b8e8;
  color: var(--text);
  font-family: 'Segoe UI', 'Noto Sans', system-ui, -apple-system, sans-serif;
}

#lobby-bg {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------- Loading & Cloud Login (Bright Sky + Parchment) ---------- */
#loading {
  background: linear-gradient(180deg, #6cbced, #b6e6fc 60%, #e4f8ff);
  color: #4b2d18;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}
#cloud-login,
.cloud-login,
#auth {
  background:
    linear-gradient(180deg, rgba(108, 188, 237, 0.35), rgba(252, 245, 227, 0.22) 60%, rgba(79, 47, 26, 0.32)),
    url('../assets/pixel/bg/sect_mountain.png') center / cover no-repeat,
    linear-gradient(180deg, #6cbced, #b6e6fc 60%, #e4f8ff) !important;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#cloud-login .cl-box,
.cloud-login .cl-box,
#auth .box {
  width: min(390px, 92vw);
  padding: 24px 28px 22px;
  background: linear-gradient(180deg, var(--cream), var(--cream2)) !important;
  border: 3px solid var(--wood-bot) !important;
  box-shadow:
    inset 0 0 0 2px var(--gold-rim),
    0 6px 0 var(--wood-dark),
    0 18px 42px rgba(40, 24, 12, 0.45) !important;
  color: var(--text) !important;
  border-radius: 14px !important;
  image-rendering: auto;
}
#auth .auth-crest {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot));
  border: 1.5px solid var(--gold-rim);
  color: #fff4d2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 2px 0 var(--wood-dark);
}
#cloud-login h1,
#cloud-login h2,
.cloud-login h1,
.cloud-login h2,
#auth h2 {
  margin: 0 0 14px;
  color: #5c3214 !important;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}
#auth .auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(116, 73, 43, 0.14);
  border: 1.5px solid #c9a265;
  border-radius: 10px;
}
#auth .auth-tabs button {
  flex: 1;
  opacity: 1 !important;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  background: transparent;
  color: #5c3a1e !important;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
#auth .auth-tabs button:hover:not(.on) {
  background: rgba(255, 252, 240, 0.65);
  color: #382112 !important;
}
#auth .auth-tabs button.on {
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot)) !important;
  border-color: var(--gold-rim) !important;
  color: #fff4d2 !important;
  box-shadow: inset 0 1px 0 rgba(255, 244, 210, 0.35), 0 2px 0 var(--wood-dark);
}
#auth label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: #4f2f1a !important;
  margin-bottom: 11px;
}
#cloud-login input,
.cloud-login input,
#auth input {
  background: #fffdf6 !important;
  color: var(--text) !important;
  border: 2px solid #b58d54 !important;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 15px;
  box-shadow: inset 0 2px 4px rgba(79, 47, 26, 0.1);
}
#auth input:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(201, 143, 40, 0.25), inset 0 2px 4px rgba(79, 47, 26, 0.08);
}
#auth .auth-msg {
  min-height: 1.3em;
  margin: 4px 0 10px;
  color: #c62828 !important;
  font-weight: 700;
  font-size: 13px;
}
#auth .auth-note {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #6f523a !important;
}
#auth button {
  background: linear-gradient(180deg, #f5e6c5, #e3cb9a);
  border: 2px solid #9a7038;
  border-radius: 8px;
  color: #382112;
  font-weight: 700;
}
#auth button.big {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 11px 24px;
  background: linear-gradient(180deg, #2ca378, #1d8a64 60%, #156649) !important;
  border: 2px solid var(--gold-rim) !important;
  border-radius: 10px;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(10, 45, 32, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 0 #0e4733;
}
#auth button.big:hover:not(:disabled) {
  filter: brightness(1.06);
}
#auth button.big:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 0 #0e4733;
}

/* ================================================================
 * SẢNH TÔNG MÔN (#lobby) — Interactive Pixel Mountain Layout
 * ================================================================ */
#lobby {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  overflow: hidden;
}
#lobby > * {
  pointer-events: auto;
}

/* Top Wooden Profile & Resource Header */
.sect-topbar {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot));
  border: 2px solid var(--gold-rim);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 244, 210, 0.35), 0 4px 0 var(--wood-dark), 0 8px 18px rgba(24, 16, 10, 0.35);
}

.sect-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  color: #fff8e4;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}
.sect-ava-box {
  width: 48px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(180deg, #b8e4fa, #7bc4e8 58%, #70c264 59%, #59a850);
  border: 2px solid var(--gold-rim);
  box-shadow: inset 0 0 0 1px #3b2214;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sect-ava-box canvas {
  width: 48px;
  height: 52px;
  image-rendering: pixelated;
}
.sect-prof-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sect-prof-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sect-prof-row b {
  font-size: 16px;
  font-weight: 800;
  color: #fffaf0;
  text-shadow: 0 1px 2px #261409;
  white-space: nowrap;
}
.sect-prof-realm {
  font-size: 12px;
  font-weight: 700;
  color: #ffe299;
}
.sect-tuvi-bar {
  position: relative;
  width: 170px;
  max-width: 38vw;
  height: 14px;
  background: #2f1a0e;
  border: 1px solid #c99c4e;
  border-radius: 99px;
  overflow: hidden;
}
.sect-tuvi-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #32b886, #6ef2b8);
}
.sect-tuvi-bar em {
  position: absolute;
  inset: 0;
  font-style: normal;
  font-size: 9.5px;
  line-height: 13px;
  text-align: center;
  color: #fffdf5;
  font-weight: 700;
  text-shadow: 0 1px 1px #1d1008;
}

.sect-top-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.sect-res-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #2e190d;
  border: 2px solid #d9ab50;
  border-radius: 9px;
  color: #fff8df;
  font-size: 15px;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}
.sect-res-pill:hover {
  filter: brightness(1.1);
}
.sect-res-pill img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}
.sect-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(180deg, #8b5936, #5f3a20);
  border: 2px solid var(--gold-rim);
  color: #fff8df;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--wood-dark);
}
.sect-icon-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Left Quick-Action Wooden Buttons (clear gap below topbar!) */
.sect-quick {
  position: fixed;
  top: 94px;
  left: 14px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sect-wood-pill {
  padding: 7px 14px;
  min-width: 102px;
  background: linear-gradient(180deg, #b87a46, #8d562c);
  border: 2px solid #4a2a16;
  border-radius: 8px;
  color: #fff9e8;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 1px #3b2010;
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.45), 0 3px 0 #3d2110;
  cursor: pointer;
  transition: transform 0.12s;
}
.sect-wood-pill:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* Interactive Building Plaques locked over the 640x360 mountain canvas */
.sect-map-overlay {
  position: fixed;
  z-index: 14;
  pointer-events: none;
}
.sect-plaque {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 9px;
  background: linear-gradient(180deg, rgba(84, 74, 68, 0.94), rgba(56, 48, 44, 0.96));
  border: 2px solid #e5c686;
  border-radius: 9px;
  box-shadow: 0 3px 0 #261e1a, 0 6px 14px rgba(20, 26, 22, 0.35);
  color: #fffaf0;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s ease, filter 0.14s ease;
}
.sect-plaque:hover {
  transform: translate(-50%, calc(-50% - 3px)) scale(1.04);
  filter: brightness(1.1);
  z-index: 5;
}
.sect-plaque .sp-ico {
  font-size: 17px;
  line-height: 1;
}
.sect-plaque .sp-txt {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.15;
}
.sect-plaque .sp-txt b {
  font-size: 13px;
  font-weight: 800;
  color: #fffbf0;
  text-shadow: 0 1px 2px #1c1410;
}
.sect-plaque .sp-txt em {
  font-style: normal;
  font-size: 10.5px;
  color: #e8dbb8;
}
/* Primary Sơn Môn plaque (warm glowing amber-gold like Image 1's "Sơn Môn · Thiên Kiếp") */
.sect-plaque.primary {
  padding: 8px 16px 8px 12px;
  background: linear-gradient(180deg, #df9246, #b56526);
  border: 2px solid #ffe48a;
  box-shadow: inset 0 1px 0 rgba(255, 250, 215, 0.5), 0 4px 0 #592d10, 0 8px 18px rgba(45, 22, 8, 0.42);
}
.sect-plaque.primary .sp-txt b {
  font-size: 14.5px;
  color: #ffffff;
}
.sect-plaque.primary .sp-txt em {
  color: #fff1c2;
  font-weight: 700;
}
.sp-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff8e4;
  animation: pulseDot 1.4s infinite;
}
.sp-dot.red {
  background: #f03e3e;
}
.sp-dot.jade {
  background: #38d98b;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

/* Goal/Quest Parchment Banner above Bottom Dock (clean breathing gap!) */
.sect-quest-banner {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  z-index: 19;
  width: min(640px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #fffaf0, #f4e6c6);
  border: 2px solid #6b4325;
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px #e8c474, 0 4px 0 #3f2412, 0 8px 18px rgba(24, 18, 12, 0.28);
}
.sq-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.sq-tag {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #c2681a;
}
.sq-info b {
  font-size: 14px;
  font-weight: 800;
  color: #361f10;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sq-info em {
  font-style: normal;
  font-size: 11.5px;
  color: #6b4e36;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sq-btn {
  flex: 0 0 auto;
  padding: 9px 20px;
  background: linear-gradient(180deg, #64cf96, #3ca872);
  border: 2px solid #236846;
  border-radius: 9px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 1px 1px #1a5436;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #1f5c3e;
  cursor: pointer;
}
.sq-btn:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

/* Bottom Wood Navigation Dock */
.sect-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 20;
  width: min(640px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 6px;
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot));
  border: 2px solid var(--gold-rim);
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--wood-dark), 0 8px 18px rgba(24, 16, 10, 0.36);
}
.snav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 5px 4px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: 8px;
  color: #f3e0be;
  cursor: pointer;
  transition: background 0.12s;
}
.snav-btn:hover {
  background: rgba(255, 232, 180, 0.14);
}
.snav-btn.active {
  background: linear-gradient(180deg, #b87e4c, #8c5930);
  border-color: #f5d178;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 245, 210, 0.35);
}
.snav-btn span {
  font-size: 18px;
  line-height: 1.1;
}
.snav-btn b {
  font-size: 11.5px;
  font-weight: 800;
}
.snav-dot {
  position: absolute;
  top: 4px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4747;
  border: 1.5px solid #fff8e4;
}

/* ================================================================
 * FULL BRIGHT PARCHMENT RE-SKIN FOR ALL HUBS, MODALS & OVERLAYS
 * (#hub, #gacha, #boss-ui, #create, #coop, #pvp-ui, #overlay, .hubmodal)
 * ================================================================ */
#hub,
#gacha,
#boss-ui,
#create,
#coop,
#pvp-ui,
#overlay,
.hubmodal {
  background: rgba(28, 42, 46, 0.45) !important;
  backdrop-filter: blur(4px);
}

/* Main floating window frames */
#hub .hub-win,
#gacha .hub-win,
#boss-ui .hub-win,
#coop .hub-win,
#pvp-ui .hub-win,
#create .cbox,
#overlay #panel,
.hubmodal .box {
  background: linear-gradient(180deg, var(--cream), var(--cream2)) !important;
  color: var(--text) !important;
  border: 3px solid var(--wood-bot) !important;
  border-radius: 14px !important;
  box-shadow: inset 0 0 0 2px var(--gold-rim), 0 8px 0 rgba(48, 28, 14, 0.55), 0 16px 40px rgba(20, 28, 26, 0.35) !important;
}

/* Warm wooden window headers */
#hub .hub-head,
#gacha .hub-head,
#boss-ui .hub-head,
#coop .hub-head,
#pvp-ui .hub-head {
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot)) !important;
  border-bottom: 2px solid var(--gold-rim) !important;
  color: #fff8e4 !important;
  border-radius: 10px 10px 0 0 !important;
}
#hub .hub-head h2,
#gacha .hub-head h2,
#boss-ui .hub-head h2,
#coop .hub-head h2,
#pvp-ui .hub-head h2 {
  color: #fff9e8 !important;
  text-shadow: 0 1px 2px #261409 !important;
}
#hub .hub-seal,
#gacha .hub-seal,
#boss-ui .hub-seal,
#coop .hub-seal,
#pvp-ui .hub-seal {
  background: linear-gradient(180deg, #df9246, #b56526) !important;
  color: #fffdf5 !important;
  border: 1.5px solid #ffe48a !important;
  text-shadow: 0 1px 1px #4c240c !important;
}
#hub .res-chip,
#gacha .res-chip,
#boss-ui .res-chip,
#coop .res-chip,
#pvp-ui .res-chip {
  background: #331c0f !important;
  border: 1.5px solid #d9ab50 !important;
  color: #fff6dc !important;
}

/* Crisp readable dark-brown text & cards inside parchment windows */
#hubbody,
#gacha .hub-win,
#boss-ui .hub-win,
#coop .hub-win,
#pvp-ui .hub-win,
#create .cbox,
#overlay #panel,
.hubmodal .box {
  color: var(--text) !important;
}
#hubbody h1, #hubbody h2, #hubbody h3, #hubbody h4,
#gacha h3, #boss-ui h3, #coop h3, #pvp-ui h3,
#create h2, #create h3,
#overlay #panel h1, #overlay #panel h2, #overlay #panel h3,
.hubmodal .box h2 {
  color: #4f2a10 !important;
  text-shadow: none !important;
}
#hubbody p, #hubbody span, #hubbody em, #hubbody td, #hubbody th,
#overlay #panel p, #overlay #panel td,
.hubmodal .box p, .hubmodal .box td {
  color: #4a311e;
}
#hubbody .sub,
#overlay #panel .sub {
  color: #705238 !important;
}

/* Cards, map entries, recipe rows, shop items, inventory cells, mastery cards, skill rows (NO wildcard > *!) */
#hubbody .mapcard,
#hubbody .mcard,
#hubbody .tucard,
#hubbody .rcard,
#hubbody .icard,
#hubbody .scard,
#hubbody .chocard,
#hubbody .cp-card,
#hubbody .bag-detail,
#hubbody .detail,
#hubbody .cell,
#hubbody .eq,
#hubbody .skill,
#hubbody .trade,
#hubbody .mst,
#hubbody .tu-hero,
#hubbody .tu-main,
#hubbody .beast-slot,
#hubbody .tu-box,
#hubbody .hub-coop-bar,
#hubbody .eq-slot,
#hubbody .slot-card,
#hubbody .dan-row,
#hubbody .recipe,
#overlay #panel .card,
#overlay #panel .loot,
#overlay #panel table.sum,
.hubmodal .box table.sum,
.hubmodal .lb-guide {
  background: linear-gradient(180deg, #fffdf6, #f4e8cd) !important;
  border: 2px solid #c9a366 !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  box-shadow: 0 2px 0 rgba(107, 67, 37, 0.22) !important;
}

/* ================================================================
 * CLEAN BREATHING SPACE & PADDING ACROSS ALL HUB TABS & MODALS
 * (No sections touching, no borders hugging text/icons!)
 * ================================================================ */
#hubbody {
  padding: 18px 22px 24px !important;
}
#hub .hub-head,
#gacha .hub-head,
#boss-ui .hub-head,
#coop .hub-head,
#pvp-ui .hub-head {
  padding: 12px 18px !important;
  gap: 12px !important;
}
#hubbody .cpf,
#hubbody .cho-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px !important;
  margin: 0 0 12px !important;
}
#hubbody .cpf button,
#hubbody .cho-mode button {
  padding: 7px 13px !important;
}
#hubbody .cho-opt,
#hubbody .cp-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 12px !important;
  padding: 2px 4px;
}

/* Công Pháp (Skills & Equipment slots) */
#hubbody .cp {
  gap: 20px !important;
}
#hubbody .cpslots {
  display: flex;
  flex-direction: column;
  gap: 14px !important;
  padding: 16px 18px !important;
  background: rgba(255, 250, 236, 0.55);
  border: 2px solid #d6b67c;
  border-radius: 12px;
}
#hubbody .cpslots .cptitle,
#hubbody .learned > h4 {
  margin: 0 0 8px !important;
  padding: 0 2px !important;
}
#hubbody .cpslots .slotrow h4 {
  margin: 0 0 6px !important;
}
#hubbody .cpslots .cells {
  gap: 8px !important;
}
#hubbody .eq {
  padding: 9px 12px !important;
  gap: 10px !important;
}
#hubbody .eq button {
  padding: 4px 10px !important;
}
#hubbody .learned {
  display: flex;
  flex-direction: column;
  gap: 10px !important;
}
#hubbody .skill {
  padding: 13px 16px !important;
  gap: 14px !important;
  margin: 0 !important;
  align-items: center !important;
}
#hubbody .skill > img {
  border-radius: 8px;
  flex-shrink: 0;
}
#hubbody .skill > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
#hubbody .skill h3,
#hubbody .skill p {
  margin: 0 !important;
}
#hubbody .skill .tag {
  padding: 5px 11px !important;
  border-radius: 7px;
  background: rgba(56, 163, 109, 0.14) !important;
  border: 1.5px solid #48a678 !important;
  color: #1f6b46 !important;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}
#hubbody .skill button {
  padding: 7px 14px !important;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Tu Luyện (Động Phủ) + Thuần Thục Trường Phái */
#hubbody .tu-wrap {
  gap: 18px !important;
  margin-bottom: 22px !important;
}
#hubbody .tu-hero,
#hubbody .tu-main {
  padding: 18px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#hubbody .tu-hero h3,
#hubbody .tu-hero p,
#hubbody .tu-main h1,
#hubbody .tu-main p {
  margin: 0 !important;
}
#hubbody .tu-act {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 !important;
}
#hubbody .tu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px !important;
  margin-top: 6px !important;
}
#hubbody .tu-links button,
#hubbody .tu-hero > button,
#hubbody .tu-act button {
  padding: 8px 16px !important;
}
#hubbody .beast-slots {
  gap: 10px !important;
  margin-top: 6px !important;
}
#hubbody .beast-slot {
  padding: 10px 12px !important;
  gap: 3px !important;
}
#hubbody .mastery {
  margin-top: 22px !important;
  padding: 18px 20px !important;
  background: rgba(255, 250, 236, 0.6) !important;
  border: 2px solid #d6b67c !important;
  border-radius: 12px !important;
}
#hubbody .mastery > h3 {
  margin: 0 0 8px !important;
  padding: 0 !important;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}
#hubbody .mastery > p {
  margin: 0 0 16px !important;
  padding: 0 !important;
  line-height: 1.5;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
}
#hubbody .mst-grid {
  gap: 12px !important;
}
#hubbody .mst {
  padding: 12px 15px !important;
  gap: 12px !important;
  align-items: center !important;
}
#hubbody .mst .mst-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#hubbody .mst h4,
#hubbody .mst p {
  margin: 0 !important;
}

/* Đan Lô (Alchemy Recipes) */
#hubbody .recipes {
  display: flex;
  flex-direction: column;
  gap: 12px !important;
  margin-top: 8px !important;
}
#hubbody .recipe {
  padding: 14px 16px !important;
  gap: 14px !important;
  align-items: center !important;
}
#hubbody .recipe h3,
#hubbody .recipe p {
  margin: 0 0 5px !important;
}
#hubbody .recipe .ins {
  display: flex;
  flex-wrap: wrap;
  gap: 8px !important;
  margin-top: 6px !important;
}
#hubbody .recipe > button {
  padding: 8px 14px !important;
  flex-shrink: 0;
}

/* Túi Đồ (Inventory Bag) */
#hubbody .bag {
  gap: 18px !important;
  margin-top: 10px !important;
}
#hubbody .bag .grid {
  gap: 10px !important;
  padding: 14px !important;
  background: rgba(255, 250, 236, 0.55);
  border: 2px solid #d6b67c;
  border-radius: 12px;
}
#hubbody .bag .cell {
  padding: 6px !important;
}
#hubbody .bag .detail {
  padding: 18px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#hubbody .bag .detail h3,
#hubbody .bag .detail p {
  margin: 0 !important;
}
#hubbody .bag .detail button {
  padding: 9px 16px !important;
}

/* Phường Thị (Market) */
#hubbody .cho-list {
  display: flex;
  flex-direction: column;
  gap: 10px !important;
  margin-top: 8px !important;
}
#hubbody .trade {
  padding: 11px 16px !important;
  gap: 12px !important;
  align-items: center !important;
}
#hubbody .trade button {
  padding: 6px 12px !important;
  flex-shrink: 0;
}
/* Second line under the item name: what it does (js/ui/hub.js tabCho) */
#hubbody .trade .trade-name {
  min-width: 0;
  line-height: 1.3;
}
#hubbody .trade .trade-desc {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  color: #7a5a3c;
  white-space: normal;
}

/* Bí Cảnh (Map Selection Cards) */
#hubbody .maps {
  gap: 16px !important;
  margin-bottom: 14px !important;
}
#hubbody .mapcard {
  padding: 16px 18px !important;
  gap: 8px !important;
}
#hubbody .hub-coop-bar {
  padding: 12px 16px !important;
  margin-bottom: 16px !important;
  gap: 12px !important;
}

/* Gacha, Boss, Create & Dialog Modals */
#create .cbox {
  padding: 22px 26px !important;
  gap: 24px !important;
}
#create .crow {
  gap: 10px !important;
  margin-bottom: 10px !important;
}
#create button {
  padding: 6px 12px !important;
}
#create .cactions {
  margin-top: 14px !important;
  gap: 12px !important;
}
#create .cactions button {
  padding: 10px 22px !important;
}
.hubmodal .box {
  padding: 22px 24px !important;
}
.hubmodal .box p {
  margin: 10px 0 !important;
  line-height: 1.5;
}
/* Disable legacy dark ::before/::after floor overlays on .win-map .mapcard so bright biome parchment shines! */
.win-map .mapcard::before,
.win-map .mapcard::after {
  display: none !important;
}
.win-map .mapcard h3,
.win-map .mapcard p {
  text-shadow: none !important;
}
.win-map .mapcard .drops img {
  background: rgba(94, 58, 30, 0.14) !important;
  border: 1.5px solid #c9a366;
  border-radius: 6px;
}

/* ================================================================
 * UPGRADED IN-RUN LEVEL-UP ("Tăng cấp") — Clean Cream Cards + Stat Chips + Reroll
 * ================================================================ */
#overlay #panel.lu-panel {
  width: min(500px, calc(100vw - 24px)) !important;
  max-width: 500px !important;
  padding: 18px 16px 14px !important;
  background: linear-gradient(180deg, #fffdf4, #f7edd6) !important;
  border: 3px solid #e2bc66 !important;
  border-radius: 16px !important;
  box-shadow: inset 0 0 0 2px #fff8e2, 0 10px 30px rgba(34, 22, 12, 0.4) !important;
}
#overlay #panel.lu-panel .lu-title {
  margin: 0 0 2px;
  font-size: 23px !important;
  font-weight: 900;
  color: #8c3d16 !important;
  text-align: center;
}
#overlay #panel.lu-panel .lu-sub {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: #7c5c3c !important;
  text-align: center;
}
.lu-cards {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}
#overlay #panel.lu-panel .card.lu-card {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100%;
  padding: 12px 14px 12px 12px !important;
  background: #ffffff !important;
  border: 2px solid #dfbe78 !important;
  border-radius: 12px !important;
  box-shadow: 0 3px 0 #d4b064 !important;
  text-align: left !important;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
#overlay #panel.lu-panel .card.lu-card:hover {
  background: #fffdf5 !important;
  border-color: #36a874 !important;
  transform: translateY(-2px);
}
.lu-kbd {
  position: absolute !important;
  top: 8px;
  left: 8px;
  right: auto !important;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5ebd4 !important;
  border: 1.5px solid #b89154 !important;
  border-radius: 6px !important;
  color: #5c3c1e !important;
  font-size: 11px !important;
  font-weight: 800;
  font-family: inherit;
}
.lu-ico {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  margin-left: 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff6df, #ecd6a2);
  border: 2px solid #d4a64a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.lu-ico img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  border-radius: 6px;
}
.lu-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.lu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lu-head h3 {
  margin: 0 !important;
  font-size: 16.5px !important;
  font-weight: 900;
  color: #3a1f0e !important;
}
.lu-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  color: #ffffff !important;
}
.lu-badge.new {
  background: linear-gradient(180deg, #f25c84, #d93864);
}
.lu-badge.up {
  background: linear-gradient(180deg, #e8a438, #c47d1c);
}
.lu-meta {
  font-size: 12px;
  color: #7c5c3e !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lu-meta b {
  color: #a85c16 !important;
}
.lu-pips {
  letter-spacing: 1px;
  font-size: 11px;
}
.lu-pip {
  color: #d8c49e !important;
}
.lu-pip.on {
  color: #e89b24 !important;
}
.lu-desc {
  margin: 2px 0 3px !important;
  font-size: 12.5px !important;
  line-height: 1.35;
  color: #4a311e !important;
}
.lu-desc b {
  color: #2c190c !important;
}
.lu-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.lu-chip {
  padding: 2px 8px;
  background: #f7efe0;
  border: 1px solid #dfd0b4;
  border-radius: 6px;
  font-size: 11px;
  color: #5e442c !important;
}
.lu-chip b {
  color: #341d0c !important;
  font-weight: 800;
}
.lu-bonus {
  margin-top: 2px;
  padding: 3px 9px;
  background: linear-gradient(180deg, #fff3c4, #fae08c);
  border: 1px solid #dfb44a;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: #7a4a0c !important;
  align-self: flex-start;
}
.lu-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
#overlay #panel.lu-panel button.lu-reroll {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px !important;
  background: linear-gradient(180deg, #e4faf0, #bcebd6) !important;
  border: 2px solid #309a70 !important;
  border-radius: 10px !important;
  color: #18573d !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
  box-shadow: 0 3px 0 #247856 !important;
}
#overlay #panel.lu-panel button.lu-reroll kbd {
  position: static !important;
  padding: 2px 6px;
  background: #ffffff !important;
  border: 1.5px solid #309a70 !important;
  border-radius: 5px;
  font-size: 11px;
  color: #18573d !important;
}
#overlay #panel.lu-panel button.lu-reroll:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Soft sunlit biome tints on the 4 Map Cards */
#hubbody .mapcard.theme-grass {
  background: linear-gradient(180deg, #effce8, #d8f0cc 55%, #f5ebd1) !important;
  border-color: #6ab55a !important;
}
#hubbody .mapcard.theme-jade {
  background: linear-gradient(180deg, #e8fbf5, #cceee2 55%, #f5ebd1) !important;
  border-color: #46a88c !important;
}
#hubbody .mapcard.theme-earth {
  background: linear-gradient(180deg, #fff3e2, #f5dec0 55%, #f5ebd1) !important;
  border-color: #d48948 !important;
}
#hubbody .mapcard.theme-snow {
  background: linear-gradient(180deg, #eef7ff, #d4e8fa 55%, #f5ebd1) !important;
  border-color: #6ea2d8 !important;
}
#hubbody .mapcard .mood,
#hubbody .mapcard .tag,
#hubbody .dan-tag,
#hubbody .tu-tag {
  background: #5a3820 !important;
  color: #fff5d6 !important;
  border: 1.5px solid #e4ba5c !important;
  border-radius: 6px !important;
  padding: 2px 9px !important;
  font-weight: 800 !important;
  display: inline-block;
}
#hubbody .dan-tag {
  margin-left: 6px;
}
#hubbody button.on em,
#hubbody button.active em {
  color: #ffe8a8 !important;
}
#hubbody .mapcard .boss {
  color: #8c3c18 !important;
  font-weight: 700;
}
#hubbody .bar {
  background: #dec99f !important;
  border: 1.5px solid #9e7440 !important;
}
#hubbody .bar > div,
#hubbody .bar > i {
  background: linear-gradient(90deg, #2da878, #60e0a8) !important;
}
#hubbody .bar span {
  color: #2e180c !important;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}
#hubbody .cell.on {
  border-color: #2da672 !important;
  box-shadow: 0 0 0 2px rgba(45, 166, 114, 0.35) !important;
}
#hubbody .mapcard:hover,
#hubbody .mcard:hover,
#overlay #panel .card:hover {
  border-color: #36a674 !important;
  filter: brightness(1.03);
  transform: translateY(-2px);
}
#hubbody .mapcard b,
#hubbody .mapcard h3,
#hubbody .mcard b,
#hubbody .mcard h3,
#overlay #panel .card h3,
#hubbody .chocard b,
#hubbody .rcard b {
  color: #3a1f0e !important;
}

/* Filter chips & secondary buttons on bright parchment */
#hubbody button,
#gacha button:not(.hub-close-x),
#boss-ui button:not(.hub-close-x),
#coop button:not(.hub-close-x),
#pvp-ui button:not(.hub-close-x),
#create button,
#overlay #panel button,
.hubmodal .box button {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99) !important;
  color: #452814 !important;
  border: 2px solid #966a38 !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  text-shadow: none !important;
  box-shadow: 0 2px 0 rgba(78, 46, 22, 0.35) !important;
}
#hubbody button:hover,
#gacha button:not(.hub-close-x):hover,
#boss-ui button:not(.hub-close-x):hover,
#coop button:not(.hub-close-x):hover,
#pvp-ui button:not(.hub-close-x):hover,
#create button:hover,
#overlay #panel button:hover,
.hubmodal .box button:hover {
  filter: brightness(1.05);
}
#hubbody button.on,
#hubbody button.active,
#gacha button:not(.hub-close-x).on,
#boss-ui button:not(.hub-close-x).on,
#coop button:not(.hub-close-x).on,
#pvp-ui button:not(.hub-close-x).on,
#create button.on {
  background: linear-gradient(180deg, #74492b, #52311b) !important;
  color: #fff8e2 !important;
  border-color: #e6bc5a !important;
}

/* Primary Jade-Emerald action buttons (matching Image 1's "Nhận" button!) */
#hubbody button.big,
#hubbody button.primary,
#hubbody button.go,
#gacha button:not(.hub-close-x).big,
#boss-ui button:not(.hub-close-x).big,
#coop button:not(.hub-close-x).big,
#pvp-ui button:not(.hub-close-x).big,
#create button.big,
#overlay #panel button.big,
.hubmodal .box button.big,
#cloud-login button.cl-go {
  background: linear-gradient(180deg, #64cf96, #38a36d) !important;
  color: #ffffff !important;
  border: 2px solid #226644 !important;
  text-shadow: 0 1px 1px #195234 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #1d573a !important;
}

/* Danger buttons */
#hubbody button.danger,
#overlay #panel button.danger,
.hubmodal .box button.danger,
.hubmodal .qcbh-plaque.danger-plaque {
  background: linear-gradient(180deg, #e86258, #c4362e) !important;
  color: #ffffff !important;
  border-color: #7d1d18 !important;
}

/* Keep close X buttons clean */
.hub-close-x {
  background: linear-gradient(180deg, #d95a4c, #ad3429) !important;
  border: 2px solid #ffe08a !important;
  border-radius: 8px !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
  position: relative;
}
.hub-close-x::before {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #fff9e6;
}

/* Settings modal buttons inside .hubmodal */
.hubmodal .set-list .qcbh-plaque {
  background: linear-gradient(180deg, #f7e8c6, #e5cc96) !important;
  border: 2px solid #8a5e32 !important;
  color: #3d2210 !important;
}
.hubmodal .set-list .qp-txt {
  color: #3d2210 !important;
  text-shadow: none !important;
}
.hubmodal .set-list .danger-plaque .qp-txt {
  color: #fff !important;
}

/* Toasts on bright background */
#toasts .toast {
  background: linear-gradient(180deg, #5e3a22, #402615) !important;
  color: #fff8e2 !important;
  border: 2px solid var(--gold-rim) !important;
  box-shadow: 0 4px 12px rgba(24, 16, 10, 0.35) !important;
}

/* Responsive mobile portrait tuning for Sảnh Tông Môn */
@media (max-width: 720px) {
  .sect-topbar {
    top: 6px;
    left: 6px;
    right: 6px;
    padding: 5px 8px;
  }
  .sect-tuvi-bar {
    width: 118px;
  }
  .sect-plaque {
    padding: 4px 8px 4px 6px;
    gap: 5px;
  }
  .sect-plaque .sp-txt b {
    font-size: 11px;
  }
  .sect-plaque .sp-txt em {
    font-size: 9px;
  }
  .sect-plaque.primary {
    padding: 6px 11px;
  }
  .sect-quest-banner {
    bottom: 78px;
    padding: 8px 12px;
  }
  .sq-info b {
    font-size: 12.5px;
  }
  .sq-btn {
    padding: 7px 13px;
    font-size: 12.5px;
  }
  .sect-quick {
    top: 84px;
    left: 8px;
    gap: 8px;
  }
  .sect-wood-pill {
    padding: 5px 10px;
    font-size: 11.5px;
    min-width: 82px;
  }
}

/* Tạo Đạo Thân: bright pixel pedestal + legible cream Đạo hiệu input */
#create #cprev {
  background: radial-gradient(circle at 50% 42%, #e8f7ea 0%, #c6e6d0 55%, #9ec4ae 100%) !important;
  border: 2.5px solid var(--wood-mid) !important;
  border-radius: 12px !important;
  box-shadow: inset 0 0 0 2px rgba(255, 252, 236, 0.7), 0 4px 12px rgba(40, 28, 16, 0.16) !important;
  image-rendering: pixelated;
}
#create #cname {
  background: #fffcf2 !important;
  color: var(--text) !important;
  border: 2px solid var(--wood-mid) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  padding: 6px 10px !important;
  box-shadow: inset 0 1px 3px rgba(60, 38, 16, 0.14) !important;
}
#create #cname:focus {
  outline: none !important;
  border-color: #2f966a !important;
  box-shadow: 0 0 0 2px rgba(47, 150, 106, 0.25) !important;
}

/* ================================================================
 * MOBILE FULLSCREEN + MANDATORY LANDSCAPE LOCK & PHONE LANDSCAPE UI
 * ================================================================ */
html,
body {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
#game {
  touch-action: none;
}
#lobby,
#ui,
#hub,
#overlay,
#rotate-lock {
  -webkit-user-select: none;
  user-select: none;
}

/* Bright Xianxia Pixel Parchment Portrait Lock Overlay (#rotate-lock) */
#rotate-lock {
  z-index: 99999 !important;
  background: radial-gradient(circle at 50% 35%, rgba(124, 200, 244, 0.96), rgba(52, 102, 134, 0.98)) !important;
  backdrop-filter: blur(8px);
}
#rotate-lock .rl-box {
  background: linear-gradient(180deg, var(--cream), var(--cream2)) !important;
  border: 3px solid var(--wood-bot) !important;
  border-radius: 16px !important;
  box-shadow: inset 0 0 0 2px var(--gold-rim), 0 8px 0 rgba(56, 32, 16, 0.55), 0 18px 40px rgba(18, 28, 36, 0.45) !important;
  padding: 24px 22px 22px !important;
  color: var(--text) !important;
}
#rotate-lock .rl-seal {
  background: linear-gradient(180deg, #df9246, #b56526) !important;
  color: #fffdf5 !important;
  border: 1.5px solid #ffe48a !important;
  padding: 4px 14px !important;
  border-radius: 99px !important;
  font-weight: 800 !important;
  letter-spacing: 0.8px !important;
  text-shadow: 0 1px 1px #4c240c !important;
}
#rotate-lock .rl-phone {
  border-color: var(--wood-bot) !important;
  background: #fff9ea !important;
  box-shadow: 0 3px 0 rgba(62, 36, 18, 0.25) !important;
}
#rotate-lock .rl-screen {
  background: linear-gradient(180deg, #86cef2, #70c464) !important;
}
#rotate-lock .rl-dot {
  background: var(--wood-mid) !important;
}
#rotate-lock .rl-arrow {
  color: #c2681a !important;
  text-shadow: none !important;
}
#rotate-lock h2 {
  color: #4f2a10 !important;
  text-shadow: none !important;
  margin-top: 8px !important;
}
#rotate-lock .rl-sub {
  color: #5b3e26 !important;
  line-height: 1.5 !important;
}
#rotate-lock .rl-sub b {
  color: #8c3d16 !important;
}
#rotate-lock .rl-btn {
  background: linear-gradient(180deg, #64cf96, #38a36d) !important;
  color: #ffffff !important;
  border: 2px solid #226644 !important;
  border-radius: 10px !important;
  padding: 11px 20px !important;
  font-size: 14.5px !important;
  font-weight: 800 !important;
  text-shadow: 0 1px 1px #195234 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #1d573a !important;
}
#rotate-lock .rl-hint {
  color: #7a5c42 !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
#rotate-lock .rl-hint.warn {
  color: #b53428 !important;
  font-weight: 700 !important;
}

/* Floating Fullscreen Pill (#fs-fab) on Mobile Landscape */
#fs-fab {
  position: fixed !important;
  top: 56px !important;
  right: max(10px, env(safe-area-inset-right)) !important;
  left: auto !important;
  transform: none !important;
  z-index: 9000 !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px !important;
  background: linear-gradient(180deg, #b87a46, #8d562c) !important;
  border: 2px solid #ffe48a !important;
  border-radius: 99px !important;
  color: #fffaf0 !important;
  font-size: 11.5px !important;
  font-weight: 800 !important;
  box-shadow: 0 3px 0 #4a2a16, 0 6px 14px rgba(24, 16, 10, 0.35) !important;
  cursor: pointer;
}
#fs-fab.in-run {
  top: 22px !important;
  right: max(46px, calc(env(safe-area-inset-right) + 40px)) !important;
  padding: 4px 8px !important;
  font-size: 11px !important;
}
#fs-fab.in-run span:last-child {
  display: none;
}
body:has(#overlay:not(.hidden)) #fs-fab,
body:has(#hub:not(.hidden)) #fs-fab,
body:has(#create:not(.hidden)) #fs-fab {
  display: none !important;
}

/* ================================================================
 * DEDICATED PHONE LANDSCAPE LAYOUT (e.g. 844x390, 800x360, 667x375)
 * ================================================================ */
@media (max-height: 520px) and (orientation: landscape) {
  /* Sảnh Tông Môn — ultra-slim single-row topbar (38px) & bottom dock (34px) leaving ~80% vertical space! */
  .sect-topbar {
    top: 4px !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    padding: 3px 10px !important;
    border-radius: 9px !important;
    gap: 8px !important;
  }
  .sect-ava-box {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
  }
  .sect-ava-box canvas {
    width: 26px !important;
    height: 26px !important;
  }
  .sect-prof-info {
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .sect-prof-row b {
    font-size: 12px !important;
  }
  .sect-prof-realm {
    font-size: 10px !important;
  }
  .sect-tuvi-bar {
    width: 98px !important;
    height: 12px !important;
  }
  .sect-tuvi-bar em {
    font-size: 8.5px !important;
  }
  .sect-res-pill {
    padding: 2px 8px !important;
    font-size: 11.5px !important;
  }
  .sect-icon-btn {
    width: 26px !important;
    height: 26px !important;
    font-size: 12px !important;
  }
  .sect-quick {
    top: 48px !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    gap: 6px !important;
  }
  #fs-fab:not(.in-run) {
    top: 48px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
  }
  .sect-wood-pill {
    padding: 4px 10px !important;
    min-width: 72px !important;
    font-size: 11px !important;
    border-radius: 7px !important;
  }
  .sect-plaque {
    padding: 2px 6px 2px 5px !important;
    gap: 4px !important;
    border-radius: 6px !important;
    border-width: 1.5px !important;
  }
  .sect-plaque .sp-ico {
    font-size: 12px !important;
  }
  .sect-plaque .sp-txt b {
    font-size: 10px !important;
  }
  .sect-plaque .sp-txt em {
    font-size: 8px !important;
  }
  .sect-plaque.primary {
    padding: 3px 9px 3px 7px !important;
  }
  .sect-plaque.primary .sp-txt b {
    font-size: 11px !important;
  }
  /* Hide redundant quest banner on ultra-short phone landscape so all 7 sect buildings stay 100% visible! */
  .sect-quest-banner {
    display: none !important;
  }
  .sect-bottom-nav {
    bottom: 4px !important;
    width: min(520px, calc(100vw - 24px)) !important;
    padding: 3px !important;
    gap: 4px !important;
    border-radius: 9px !important;
  }
  .snav-btn {
    flex-direction: row !important;
    gap: 5px !important;
    padding: 4px 6px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
  }
  .snav-btn span {
    font-size: 13px !important;
  }
  .snav-btn b {
    font-size: 10.5px !important;
  }

  /* Combat HUD + Touch Controls on Phone Landscape */
  #xpbar {
    height: 15px !important;
  }
  #xplabel {
    font-size: 10px !important;
    line-height: 15px !important;
  }
  #hudrow {
    padding: 3px max(44px, calc(env(safe-area-inset-right) + 38px)) 0 max(8px, env(safe-area-inset-left)) !important;
  }
  #timer {
    font-size: 13px !important;
    padding: 2px 10px !important;
  }
  #stats {
    font-size: 11px !important;
    padding: 2px 8px !important;
  }
  #pausebtn {
    top: 19px !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
  }
  #skillbar {
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    gap: 6px !important;
  }
  #skillbar .sk,
  #pillbar .pl {
    width: 40px !important;
    height: 40px !important;
  }

  /* In-Run Level-Up ("Tăng cấp"): 3-column horizontal cards fit 100% inside 390px height! */
  #overlay #panel.lu-panel {
    width: min(760px, calc(100vw - 24px)) !important;
    max-width: 760px !important;
    padding: 10px 12px 9px !important;
    max-height: 94dvh !important;
    overflow-y: auto !important;
  }
  #overlay #panel.lu-panel .lu-title {
    font-size: 17px !important;
  }
  #overlay #panel.lu-panel .lu-sub {
    font-size: 11px !important;
    margin-bottom: 8px !important;
  }
  .lu-cards {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }
  #overlay #panel.lu-panel .card.lu-card {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 8px 9px !important;
    gap: 6px !important;
  }
  .lu-kbd {
    display: none !important;
  }
  .lu-ico {
    width: 40px !important;
    height: 40px !important;
    margin-left: 0 !important;
    align-self: center !important;
  }
  .lu-head {
    justify-content: center;
    gap: 5px;
  }
  .lu-head h3 {
    font-size: 13px !important;
    text-align: center;
  }
  .lu-meta {
    justify-content: center;
    font-size: 10.5px;
  }
  .lu-desc {
    font-size: 11px !important;
    line-height: 1.3;
    text-align: center;
  }
  .lu-chips {
    justify-content: center;
    gap: 4px;
  }
  .lu-chip {
    font-size: 9.5px !important;
    padding: 1px 5px !important;
  }
  .lu-bonus {
    font-size: 10px !important;
    align-self: center !important;
  }
  .lu-actions {
    margin-top: 8px !important;
  }
  #overlay #panel.lu-panel button.lu-reroll {
    padding: 5px 14px !important;
    font-size: 12px !important;
  }

  /* Hub, Boss, Gacha & Tạo Đạo Thân modals on Phone Landscape */
  #hub .hub-win,
  #gacha .hub-win,
  #boss-ui .hub-win,
  #coop .hub-win,
  #pvp-ui .hub-win {
    width: min(96vw, 840px) !important;
    max-height: 94dvh !important;
  }
  #hub .hub-head,
  #gacha .hub-head,
  #boss-ui .hub-head,
  #coop .hub-head,
  #pvp-ui .hub-head {
    padding: 7px 12px !important;
  }
  #hub .hub-head h2 {
    font-size: 15px !important;
  }
  #hubbody {
    padding: 12px 14px 16px !important;
    -webkit-overflow-scrolling: touch;
  }
  #create .cbox {
    max-width: min(96vw, 820px) !important;
    max-height: 94dvh !important;
    padding: 12px 16px !important;
    gap: 14px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  #create #cprev {
    width: 176px !important;
    height: 196px !important;
  }
  #create .cform h1 {
    font-size: 18px !important;
    margin: 0 0 2px !important;
  }
  #create .csub {
    font-size: 11px !important;
    margin: 0 0 8px !important;
  }
  #create .crow {
    gap: 6px !important;
    margin-bottom: 6px !important;
  }
  #create button {
    padding: 4px 9px !important;
    font-size: 11.5px !important;
  }
  #create .cactions {
    margin-top: 8px !important;
  }
  #create .cactions button {
    padding: 7px 16px !important;
  }
}

/* ================================================================
 * CẦU ĐẠO (#gacha), TRẤN MA ĐÀI (#boss-ui), CO-OP (#coop), LUẬN ĐẠO (#pvp-ui)
 * style.css paints their insides for the old dark windows: near-black panels plus text in var(--text) / var(--muted) /
 * var(--gold2), which this theme turns dark brown, so text ended up dark-on-dark. Panels become parchment cards here
 * and the few hard-coded light text colours become theme browns. Kept dark on purpose: the boss preview stage and the
 * gacha image wells, so sprites and rarity glows still pop.
 * ================================================================ */
/* Tabs: the parchment buttons above already style them; drop the dark stone/gold images */
#pvp-ui .bs-tab,
#boss-ui .bs-tab,
#gacha .gc-tabs button {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99) !important;
  color: #452814 !important;
  border: 2px solid #966a38 !important;
}
#pvp-ui .bs-tab.on,
#boss-ui .bs-tab.on,
#gacha .gc-tabs button.on {
  background: linear-gradient(180deg, #74492b, #52311b) !important;
  color: #fff8e2 !important;
  border-color: #e6bc5a !important;
}

/* Parchment cards */
.pv-card,
.pv-team,
.gc-info,
.gc-feat,
.gc-res,
.gc-pcard,
.gc-rates-box,
.bs-pick,
.bs-tip,
.bs-skills span,
.bs-tier,
.bs-foot-bar,
.bs-world-act,
.bs-rew,
.bs-hp-box,
.bs-ms,
.bs-board-wrap,
.bs-rk-tier,
.coop-panel,
.coop-open-wrap,
.coop-room-row,
.coop-room-head,
.coop-slot,
.coop-map-card,
.coop-actions {
  background: linear-gradient(180deg, #fffdf6, #f4e8cd) !important;
  border-color: #c9a366 !important;
  color: var(--text) !important;
  box-shadow: 0 2px 0 rgba(107, 67, 37, 0.18) !important;
}
/* keep the coloured accents that carry meaning (rarity, boss element, team side, selection) */
.gc-feat.r-SSR, .gc-res.r-SSR, .gc-pcard.r-SSR { border-color: #d9a520 !important; }
.gc-feat.r-SR, .gc-res.r-SR, .gc-pcard.r-SR { border-color: #a45ad6 !important; }
.gc-feat.r-R, .gc-res.r-R, .gc-pcard.r-R { border-color: #3d94cf !important; }
.bs-pick { border-left: 4px solid var(--bc, var(--gold)) !important; }
#boss-ui button.bs-pick.on:not(.hub-close-x),
#boss-ui button.bs-tier.on:not(.hub-close-x),
.coop-map-card.selected,
.bs-rk-tier.mine,
.bs-ms.ready {
  background: linear-gradient(180deg, #fff4d2, #f0d99c) !important;
  border-color: #c98f28 !important;
}
#boss-ui button.bs-pick.on:not(.hub-close-x) { border-left-color: var(--bc, var(--gold)) !important; color: var(--text) !important; }
#boss-ui button.bs-tier.on:not(.hub-close-x) { color: #3a1f0e !important; }
.pv-team.team-A { border-color: #1d8a64 !important; }
.pv-team.team-B { border-color: #d43832 !important; }
.bs-rew.gold { border-color: #d9a520 !important; color: #8a5a00 !important; }
.bs-rew.purple { border-color: #a45ad6 !important; color: #6b2f99 !important; }
.pv-mem,
.bs-el,
.cr-code {
  background: #fbf1d8 !important;
}

/* Inputs */
.pv-card input,
.pv-card select,
.pv-row input,
.coop-field select,
.coop-join-row input {
  background: #fffaf0 !important;
  color: var(--text) !important;
  border: 2px solid #b88a4a !important;
  border-radius: 6px !important;
}
.pv-card input::placeholder,
.pv-row input::placeholder,
.coop-join-row input::placeholder {
  color: #9a7a5c !important;
}
.pv-card select:disabled,
.pv-card input:disabled {
  background: #efe3c8 !important;
  color: #6f523a !important;
}

/* Buttons that carried their own dark look */
#pvp-ui .pv-btn,
#pvp-ui .pv-mini {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99) !important;
  color: #452814 !important;
  border: 2px solid #966a38 !important;
  border-radius: 8px !important;
}
#pvp-ui .pv-btn.go,
#boss-ui button.bs-fight-btn:not(.hub-close-x),
#boss-ui button.bs-claim-rk:not(.hub-close-x),
#coop button.big {
  background: linear-gradient(180deg, #64cf96, #38a36d) !important;
  color: #fff !important;
  border: 2px solid #226644 !important;
  text-shadow: 0 1px 1px #195234 !important;
}
#coop button.big.secondary:not(.hub-close-x) {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99) !important;
  color: #452814 !important;
  border-color: #966a38 !important;
  text-shadow: none !important;
}
#boss-ui button.bs-buy-btn:not(.hub-close-x) {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99) !important;
  color: #6b3c0c !important;
  border: 2px solid #966a38 !important;
}
#coop button.danger:not(.hub-close-x),
#pvp-ui button.danger:not(.hub-close-x) {
  background: linear-gradient(180deg, #e86258, #c4362e) !important;
  color: #fff !important;
  border-color: #7d1d18 !important;
}
:is(#gacha, #boss-ui, #coop, #pvp-ui) button:not(.hub-close-x):disabled {
  opacity: 0.55;
  filter: grayscale(0.4);
}

/* Tables */
.pv-table th,
.bs-board th {
  background: #e9d3a3 !important;
  color: #4f2a10 !important;
  border-bottom: 2px solid #c9a366 !important;
}
.pv-table td,
.bs-board td {
  color: var(--text) !important;
  border-bottom: 1px solid rgba(160, 120, 60, 0.28) !important;
}
.pv-table tr.me td,
.bs-board tr.me td {
  background: rgba(29, 138, 100, 0.12) !important;
}
.bs-board .rk-bar {
  background: rgba(107, 67, 37, 0.15) !important;
}

/* Hard-coded light text -> theme browns */
.gc-sub,
.gc-pinfo p,
.gc-badge,
.bs-lore,
.bs-tier,
.bs-stat-line,
.bs-rew,
.bs-hp-head,
.bs-ms,
.bs-att-info span,
.bs-board .rk-sub,
.bs-rk-tier span,
.bs-pick-txt em,
.bs-tier span,
.bs-att-info em,
.bs-rk-wait,
.bs-empty,
.bs-tip {
  color: #6f523a !important;
}
.gc-feat b,
.gc-res b,
.bs-pick-txt b,
.bs-stat-line b,
.bs-tier.on span,
.bs-hp-head b,
.bs-ms span,
.bs-skills span {
  color: #3a1f0e !important;
}
.gc-stars {
  color: #c98f28 !important;
}
.pv-msg {
  background: #fde3de !important;
  color: #9c2a20 !important;
  border-color: #d97b6e !important;
}
.pv-ready { color: #c4362e !important; }
.pv-ready.on,
.gc-badge.new,
.gc-eqtag,
.cs-role.ready,
.cmc-status.ok,
.ca-status.ok,
.cs-link.connected { color: #1d8a64 !important; }
.cr-cnt,
.cms-rule { color: #156649 !important; }
.cr-warn,
.cmc-status.bad,
.cs-link.failed { color: #c4362e !important; }
.ca-status,
.cs-link.connecting { color: #9a6200 !important; }
.gc-res.r-SR .gc-rtag { color: #8a3fc0 !important; }
.gc-res.r-R .gc-rtag { color: #2a78b0 !important; }

/* In-run co-op panels over the battlefield: small parchment plates */
#coop-hud,
#coop-wait {
  background: rgba(252, 245, 227, 0.94) !important;
  border: 2px solid #b88a4a !important;
  color: var(--text) !important;
}
#coop-hud .st-ok { color: #1d8a64 !important; }
#coop-hud .st-dead { color: #c4362e !important; }
#coop-hud .st-left { color: #6f523a !important; }
#coop-hud .ch-bar { background: rgba(107, 67, 37, 0.18) !important; }

/* ================================================================
 * ĐẠO HỮU (#social-ui), WORLD CHAT DOCK (#chat-dock), PARTY INVITE POP-UP (.so-pop) — js/ui/social.js
 * ================================================================ */
#social-ui {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  background: rgba(28, 42, 46, 0.45);
  backdrop-filter: blur(4px);
  overflow: auto;
}
#social-ui.hidden,
#chat-dock.hidden {
  display: none;
}
#social-ui .hub-win {
  max-width: 720px;
  width: 100%;
  max-height: 86vh;
  background: linear-gradient(180deg, var(--cream), var(--cream2)) !important;
  color: var(--text) !important;
  border: 3px solid var(--wood-bot) !important;
  border-radius: 14px !important;
  box-shadow: inset 0 0 0 2px var(--gold-rim), 0 8px 0 rgba(48, 28, 14, 0.55), 0 16px 40px rgba(20, 28, 26, 0.35) !important;
}
#social-ui .hub-head {
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot)) !important;
  border-bottom: 2px solid var(--gold-rim) !important;
  border-radius: 10px 10px 0 0 !important;
  padding: 12px 18px !important;
  gap: 12px !important;
  display: flex;
  align-items: center;
}
#social-ui .hub-head h2 {
  color: #fff9e8 !important;
  text-shadow: 0 1px 2px #261409 !important;
}
#social-ui .hub-seal {
  background: linear-gradient(180deg, #df9246, #b56526) !important;
  color: #fffdf5 !important;
  border: 1.5px solid #ffe48a !important;
}
.so-tabs {
  display: flex;
  gap: 8px;
  flex: 1;
}
.so-tabs button,
.so-btn {
  background: linear-gradient(180deg, #f7e9c6, #e5cd99);
  color: #452814;
  border: 2px solid #966a38;
  border-radius: 8px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(78, 46, 22, 0.35);
  white-space: nowrap;
}
.so-tabs button.on {
  background: linear-gradient(180deg, #74492b, #52311b);
  color: #fff8e2;
  border-color: #e6bc5a;
}
.so-btn.go {
  background: linear-gradient(180deg, #64cf96, #38a36d);
  color: #fff;
  border-color: #226644;
  text-shadow: 0 1px 1px #195234;
}
.so-btn:hover,
.so-tabs button:hover {
  filter: brightness(1.06);
}
.so-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d43832;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}
.so-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
}
.so-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.so-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #fffdf6, #f4e8cd);
  border: 2px solid #c9a366;
  border-radius: 10px;
}
.so-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #b9a68a;
  flex-shrink: 0;
}
.so-dot.on {
  background: #29b36f;
  box-shadow: 0 0 6px rgba(41, 179, 111, 0.7);
}
.so-who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.so-who b {
  color: #3a1f0e;
}
.so-who em {
  color: #7a5a3c;
  font-size: 12px;
  font-style: normal;
}
.so-who small {
  color: #6f523a;
  font-size: 12px;
}
.so-empty,
.so-add p {
  color: #6f523a;
  line-height: 1.5;
}
.so-addrow {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}
.so-addrow input {
  flex: 1;
  padding: 8px 10px;
  background: #fffaf0;
  color: var(--text);
  border: 2px solid #b88a4a;
  border-radius: 6px;
  font-size: 14px;
}
.so-me b {
  color: #4f2a10;
}
.so-msg {
  margin: 12px 0 0;
  padding: 8px 12px;
  background: #fff3c4;
  border: 1px solid #dfb44a;
  border-radius: 8px;
  color: #6b3c0c;
}
.sect-wood-pill .so-badge {
  margin-left: 4px;
}

/* World chat dock (lobby, bottom-left) */
#chat-dock {
  position: fixed;
  left: 12px;
  bottom: 96px;
  z-index: 19;
}
#chat-dock .cd-toggle {
  padding: 8px 14px;
  background: linear-gradient(180deg, #b87a46, #8d562c);
  border: 2px solid #4a2a16;
  border-radius: 10px;
  color: #fff9e8;
  font-weight: 800;
  text-shadow: 0 1px 1px #3b2010;
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, 0.45), 0 3px 0 #3d2110;
  cursor: pointer;
}
#chat-dock.open {
  width: min(360px, calc(100vw - 24px));
  height: 300px;
  display: flex;
  flex-direction: column;
  background: rgba(252, 245, 227, 0.96);
  border: 3px solid var(--wood-bot);
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px var(--gold-rim), 0 6px 18px rgba(20, 28, 26, 0.35);
  overflow: hidden;
}
#chat-dock .cd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(180deg, var(--wood-top), var(--wood-bot));
  color: #fff8e4;
}
#chat-dock .cd-min {
  background: none;
  border: none;
  color: #fff8e4;
  font-weight: 900;
  cursor: pointer;
  padding: 0 6px;
}
#chat-dock .cd-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
}
#chat-dock .cd-line {
  word-break: break-word;
}
#chat-dock .cd-time {
  color: #9a7a5c;
  font-size: 11px;
  margin-right: 5px;
}
#chat-dock .cd-name {
  background: none;
  border: none;
  padding: 0;
  color: #1f6fa8;
  font-weight: 800;
  cursor: pointer;
  font-size: inherit;
}
#chat-dock .cd-name:hover {
  text-decoration: underline;
}
#chat-dock .cd-me {
  color: #1d8a64;
}
#chat-dock .cd-realm {
  margin-left: 4px;
  color: #9a6200;
  font-size: 11px;
}
#chat-dock .cd-empty {
  color: #8a6d50;
  text-align: center;
  margin-top: 40px;
}
#chat-dock .cd-form {
  display: flex;
  gap: 6px;
  padding: 6px 8px 8px;
  border-top: 1px solid #d9bd85;
}
#chat-dock #cd-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  background: #fffaf0;
  color: var(--text);
  border: 2px solid #b88a4a;
  border-radius: 6px;
}

/* Friend's party invite pop-up */
.so-pop {
  position: fixed;
  top: 84px;
  right: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 300px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fffdf6, #f4e8cd);
  border: 3px solid var(--wood-bot);
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px var(--gold-rim), 0 8px 20px rgba(20, 28, 26, 0.35);
  color: var(--text);
}
.so-pop em {
  font-style: normal;
  font-weight: 800;
  color: #9a6200;
}
.so-pop span {
  display: flex;
  gap: 8px;
}

@media (max-height: 520px) {
  #chat-dock {
    bottom: 76px;
  }
  #chat-dock {
    bottom: 70px;
  }
  #chat-dock.open {
    /* phones in landscape are short: room to read beats keeping the pills visible; "—" folds it away */
    height: min(240px, calc(100dvh - 130px));
  }
  #social-ui .hub-win {
    max-height: 94dvh;
  }
}


/* ============================================================================
 * THANH VÂN TIÊN TRẤN — Playable Online Town Lobby
 * ============================================================================ */
#town-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 6;
  touch-action: none;
  image-rendering: pixelated;
}
#town-canvas.hidden {
  display: none !important;
}

/* In Town mode, hide static mountain plaques & bottom dock, keep top/bottom map open */
#lobby.town-mode {
  pointer-events: none;
}
#lobby.town-mode .sect-topbar {
  top: 8px;
  left: 10px;
  right: 10px;
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}
#lobby.town-mode .sect-profile {
  pointer-events: auto;
  gap: 7px;
  padding: 4px 9px 4px 5px;
  background: linear-gradient(180deg, rgba(139, 90, 52, 0.94), rgba(92, 55, 29, 0.94));
  border: 2px solid var(--gold-rim);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--wood-dark), 0 5px 12px rgba(0, 0, 0, 0.35);
}
#lobby.town-mode .sect-ava-box {
  width: 36px;
  height: 38px;
  border-radius: 7px;
}
#lobby.town-mode .sect-ava-box canvas {
  width: 36px;
  height: 38px;
}
#lobby.town-mode .sect-prof-row b {
  font-size: 13px;
}
#lobby.town-mode .sect-prof-realm {
  font-size: 10.5px;
  line-height: 1.1;
}
#lobby.town-mode .sect-tuvi-bar {
  width: 122px;
  height: 11px;
}
#lobby.town-mode .sect-tuvi-bar em {
  font-size: 8.5px;
  line-height: 10px;
}
#lobby.town-mode .sect-top-right {
  pointer-events: auto;
  gap: 5px;
  padding: 4px 6px;
  background: linear-gradient(180deg, rgba(139, 90, 52, 0.94), rgba(92, 55, 29, 0.94));
  border: 2px solid var(--gold-rim);
  border-radius: 10px;
  box-shadow: 0 3px 0 var(--wood-dark), 0 5px 12px rgba(0, 0, 0, 0.35);
}
#lobby.town-mode .sect-res-pill {
  padding: 3px 9px;
  font-size: 13px;
}
#lobby.town-mode .sect-res-pill img {
  width: 17px;
  height: 17px;
}
#lobby.town-mode .sect-icon-btn {
  width: 30px;
  height: 30px;
  font-size: 15px;
}

#lobby.town-mode .town-left-menu,
#lobby.town-mode .hubmodal {
  pointer-events: auto;
}
#lobby.town-mode #sect-overlay,
#lobby.town-mode .sect-quest-banner,
#lobby.town-mode .sect-bottom-nav {
  display: none !important;
}

/* Unified Compact Left-Side Vertical Menu in Town Mode */
.town-left-menu {
  position: fixed;
  top: 72px;
  left: 10px;
  z-index: 20;
  width: 118px;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  background: linear-gradient(180deg, rgba(114, 71, 40, 0.9), rgba(74, 44, 24, 0.92));
  border: 2px solid var(--gold-rim);
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--wood-dark), 0 8px 18px rgba(0, 0, 0, 0.36);
}
.town-left-menu::-webkit-scrollbar {
  display: none;
}
.tlm-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 27px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 7px;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(164, 108, 62, 0.92), rgba(122, 76, 40, 0.95));
  border: 1.5px solid #d9ab50;
  border-radius: 7px;
  color: #fff6dc;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(48, 26, 12, 0.8);
  transition: transform 0.1s, filter 0.1s;
}
.tlm-btn:hover {
  filter: brightness(1.1);
  transform: translateX(2px);
}
.tlm-btn.primary {
  background: linear-gradient(180deg, #e08d38, #b55e1a);
  border-color: #ffe28a;
  color: #fffdf2;
}
.tlm-btn.tlm-sec {
  background: linear-gradient(180deg, rgba(128, 84, 50, 0.9), rgba(92, 58, 32, 0.94));
  border-color: rgba(217, 171, 80, 0.72);
}
.tlm-btn span {
  font-size: 13px;
  line-height: 1;
  flex: 0 0 auto;
}
.tlm-btn b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tlm-btn .snav-dot {
  position: absolute;
  top: 4px;
  right: 5px;
}
.tlm-sep {
  display: block;
  height: 1px;
  margin: 2px 4px;
  background: rgba(240, 200, 120, 0.35);
}

/* Floating Town HUD (Online counter top-right, Talk prompt bottom-center, Sit/Emote/Attack bottom-right) */
#town-hud {
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
}
#town-hud.hidden {
  display: none !important;
}
.th-pill {
  position: fixed;
  top: 52px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(34, 24, 16, 0.84);
  border: 1.5px solid #d6a456;
  border-radius: 999px;
  color: #fff4d2;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.th-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
}
.th-dot.on {
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.th-talk {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #fff6dc, #ecd8a6);
  border: 2px solid #7d4e24;
  border-radius: 999px;
  color: #361f10;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 0 #5b3719, 0 8px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
  animation: thPop 0.16s ease-out;
}
.th-talk kbd {
  padding: 1px 6px;
  background: #5b3719;
  color: #ffe8a6;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
}
@keyframes thPop {
  from { transform: translateX(-50%) scale(0.9); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

.th-bar {
  position: fixed;
  right: 12px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}
.th-btn {
  padding: 7px 11px;
  background: linear-gradient(180deg, #8b5a34, #5e381d);
  border: 2px solid #e5bd6e;
  border-radius: 10px;
  color: #fff6dc;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 3px 0 #3a200f, 0 5px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}
.th-btn:hover {
  filter: brightness(1.08);
}
.th-btn.on {
  background: linear-gradient(180deg, #4cc38a, #2c8a5e);
  border-color: #a6f7cf;
}

.th-emotes {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  gap: 4px;
  padding: 6px;
  background: rgba(34, 22, 14, 0.94);
  border: 2px solid #e5bd6e;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.th-emotes button {
  width: 34px;
  height: 34px;
  font-size: 19px;
  background: rgba(255, 240, 200, 0.1);
  border: 1px solid rgba(255, 220, 150, 0.25);
  border-radius: 8px;
  cursor: pointer;
}
.th-emotes button:hover {
  background: rgba(255, 220, 140, 0.28);
  transform: scale(1.12);
}

/* Remote Player Interaction Popup Card */
#town-pcard {
  position: fixed;
  left: 50%;
  bottom: 138px;
  transform: translateX(-50%);
  z-index: 25;
  width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  background: linear-gradient(180deg, #fff8e6, #eedcb5);
  border: 2px solid #7d4e24;
  border-radius: 14px;
  color: #341e0e;
  box-shadow: 0 5px 0 #573416, 0 12px 28px rgba(0, 0, 0, 0.45);
}
#town-pcard.hidden {
  display: none !important;
}
.tp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.tp-head b {
  display: block;
  font-size: 15px;
  color: #3a1f0b;
}
.tp-head em {
  font-style: normal;
  font-size: 11.5px;
  color: #7c542e;
}
.tp-x {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #a67848;
  background: rgba(120, 74, 34, 0.12);
  color: #4c2d14;
  font-weight: 800;
  cursor: pointer;
}
.tp-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 9px;
  margin-bottom: 10px;
  background: rgba(120, 80, 38, 0.09);
  border-radius: 8px;
  font-size: 12px;
}
.tp-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tp-btn {
  flex: 1 1 44%;
  padding: 7px 10px;
  border-radius: 8px;
  border: 2px solid #7d4e24;
  background: linear-gradient(180deg, #f6e4bc, #dfbe82);
  color: #3a200e;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.tp-btn.go {
  background: linear-gradient(180deg, #5cc991, #389a67);
  border-color: #216341;
  color: #fff;
}

@media (max-width: 680px) {
  .town-left-menu { width: 102px; top: 58px; }
  .tlm-btn { padding: 4px 6px; font-size: 11px; }
  .th-pill { top: 48px; right: 8px; font-size: 10.5px; padding: 3px 8px; }
  .th-bar { right: 8px; bottom: 10px; }
  .th-btn { padding: 6px 9px; font-size: 12px; }
  .th-talk { bottom: 54px; font-size: 12px; }
}
