:root {
  /* Light theme — black / white / royal gold (hoàng kim) */
  --bg-0: #090e1c;
  --ink: #241d10;
  --ink-dim: #6a5f47;
  --purple: #c9a227;
  --purple-glow: #8a6a1a;
  /* repurposed as gold accents */
  --teal: #0f766e;
  --gold: #b8860b;
  --gold-2: #8a6a10;
  --gold-lt: #f2d885;
  --red: #dc2626;
  --blood: #b91c1c;
  --green: #059669;
  --rare: #0284c7;
  --epic: #7c3aed;
  --legend: #b45309;
  --myth: #be123c;
  --panel: rgba(255, 251, 242, .94);
  --border: rgba(176, 138, 42, .5);
  --shadow: 0 14px 40px rgba(120, 92, 24, .22);
  --font-display: 'Baloo 2', cursive, sans-serif;
  --font-body: 'Nunito', 'Be Vietnam Pro', system-ui, sans-serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  width: 100dvw;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #090e1c !important;
  font-family: var(--font-body);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: .01em;
  touch-action: none;
  overscroll-behavior: none !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior-y: none !important;
}

#game-root {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none !important;
}

button, a, .btn, .icon-btn, [role="button"] {
  touch-action: manipulation;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

input, textarea, select, [contenteditable="true"] {
  -webkit-touch-callout: default !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  touch-action: manipulation !important;
}

img {
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
  user-select: none !important;
}

@media screen and (max-width: 1024px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

/* Forced Landscape for Mobile Devices in portrait */
html.forced-landscape,
body.forced-landscape {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none !important;
  background: #090e1c !important;
}

body.forced-landscape #boot,
body.forced-landscape #game-root {
  position: fixed;
  top: 0;
  left: 100vw;
  left: 100dvw;
  width: 100vh;
  width: 100dvh;
  height: 100vw;
  height: 100dvw;
  transform: rotate(90deg);
  transform-origin: 0 0;
  overflow: hidden;
}

body.forced-landscape.rot-flip #boot,
body.forced-landscape.rot-flip #game-root {
  top: 100vh;
  top: 100dvh;
  left: 0;
  transform: rotate(-90deg);
}

body.forced-landscape>.toast-area {
  position: fixed;
  top: 0;
  left: 100vw;
  left: 100dvw;
  width: 100vh;
  width: 100dvh;
  height: 100vw;
  height: 100dvw;
  transform: rotate(90deg);
  transform-origin: 0 0;
  pointer-events: none !important;
  background: transparent !important;
  background-color: transparent !important;
  overflow: visible;
  z-index: 999999;
}

body.forced-landscape.rot-flip>.toast-area {
  top: 100vh;
  top: 100dvh;
  left: 0;
  transform: rotate(-90deg);
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #14122e;
  touch-action: none;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  overscroll-behavior: none !important;
}

/* drags steer the floating joystick, never scroll / zoom the page */
.hidden {
  display: none !important
}

/* ---------- Titles / fonts ---------- */
.game-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(42px, 8vw, 86px);
  letter-spacing: .04em;
  background: linear-gradient(180deg, #5a430f, #b8860b 45%, #f0d372 62%, #9c7616);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, .95)) drop-shadow(0 0 6px rgba(0, 0, 0, .85)) drop-shadow(0 3px 10px rgba(0, 0, 0, .7)) drop-shadow(0 3px 18px rgba(184, 134, 11, .45));
  line-height: 1.1
}

.game-subtitle {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .2em;
  font-size: clamp(14px, 3vw, 24px);
  color: #ffe9a8;
  margin-top: 4px;
  text-shadow: 0 0 4px rgba(0, 0, 0, .9), 0 1px 3px rgba(0, 0, 0, .95), 0 2px 8px rgba(0, 0, 0, .7)
}

.game-tagline {
  color: #f4eeda;
  text-shadow: 0 0 4px rgba(0, 0, 0, .9), 0 1px 3px rgba(0, 0, 0, .95);
  font-style: italic;
  margin: 14px auto 22px;
  max-width: 600px;
  font-size: 15px;
  font-family: var(--font-body);
  text-align: center
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 3.5vw, 30px);
  color: var(--gold-lt);
  text-shadow: 0 2px 6px rgba(0, 0, 0, .6);
  margin-bottom: 18px;
  text-align: center
}

/* ---------- Overlays ---------- */
/* scrolls when its content is taller than the screen (phones: character select, codex...). The content is
   centred with margin:auto instead of align-items:center, which would push the top out of reach. */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  animation: fadeIn .35s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important
}

.overlay::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important
}

.overlay>:not(.menu-particles) {
  margin: auto
}

.name-modal {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

/* Tiên cảnh núi non: light sky + layered mountain silhouettes + sun (inline SVG) */
.menu-screen {
  background:
    radial-gradient(ellipse 95% 80% at 50% 42%, rgba(8, 6, 22, .32) 25%, rgba(6, 5, 18, .66) 80%),
    url("../assets/background/main_background.webp") center/cover no-repeat,
    #14122e;
}

.menu-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 560px;
  width: 100%
}

.menu-content.wide {
  max-width: 940px
}

.menu-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden
}

/* ================= EPIC XIANXIA MAIN MENU ================= */
.menu-content-epic {
  max-width: 820px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px;
}

/* 1. Top Floating Userbar Pill */
.menu-userbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 9999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  margin-bottom: 4px;
}

.userbar-avatar {
  color: #f59e0b;
  font-size: 14px;
}

.userbar-info {
  font-size: 13.5px;
  color: #e2e8f0;
  font-family: var(--font-body);
  letter-spacing: 0.02em;
}

.userbar-info b {
  color: #fde047;
  font-weight: 800;
  font-size: 15px;
}

.userbar-logout-btn {
  background: rgba(220, 38, 38, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.userbar-logout-btn:hover {
  background: rgba(220, 38, 38, 0.65);
  border-color: #ef4444;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

/* 2. Main Title Box & Aura */
.menu-title-box {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.menu-title-glow {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 120px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.28) 0%, transparent 72%);
  pointer-events: none;
  filter: blur(24px);
  z-index: -1;
}

/* 3. Action Panel */
.menu-action-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin-top: 4px;
}

/* Elegant Glassmorphic Server Selector Bar */
.menu-server-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 18px;
  background: rgba(18, 14, 38, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.menu-server-bar:hover {
  background: rgba(30, 24, 60, 0.9);
  border-color: rgba(245, 158, 11, 0.8);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.32), 0 6px 24px rgba(0, 0, 0, 0.6);
  transform: translateY(-2px);
}

.menu-server-bar:active {
  transform: translateY(1px);
}

.srv-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.srv-badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  flex-shrink: 0;
  animation: pulseDot 2s infinite ease-in-out;
}

.srv-badge-dot.lv-yellow {
  background: #facc15;
  box-shadow: 0 0 10px #facc15;
}

.srv-badge-dot.lv-red {
  background: #f87171;
  box-shadow: 0 0 10px #f87171;
}

@keyframes pulseDot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.25);
    opacity: 0.75;
  }
}

.srv-bar-label {
  font-size: 13px;
  color: #d6d3d1;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.srv-bar-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: #fef08a;
  letter-spacing: 0.03em;
  text-shadow: 0 0 10px rgba(254, 240, 138, 0.35);
}

.srv-bar-action {
  font-size: 12px;
  font-weight: 700;
  color: #f59e0b;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.menu-server-bar:hover .srv-bar-action {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.7);
  color: #fff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

/* Celestial Play Button */
.btn-play-hero {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 16px 28px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2b1e05;
  background: linear-gradient(135deg, #fef08a 0%, #f59e0b 45%, #d97706 100%);
  border: 2px solid #fef08a;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 0 28px rgba(245, 158, 11, 0.5), 0 8px 24px rgba(0, 0, 0, 0.55), inset 0 1px 2px rgba(255, 255, 255, 0.85);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.btn-hero-rune {
  font-size: 16px;
  color: #78350f;
  opacity: 0.8;
  animation: runeSpin 3s ease-in-out infinite alternate;
}

@keyframes runeSpin {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.2);
    opacity: 1;
    text-shadow: 0 0 8px #f59e0b;
  }
}

.btn-play-hero:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 38px rgba(245, 158, 11, 0.75), 0 14px 32px rgba(0, 0, 0, 0.65), inset 0 1px 2px #fff;
  background: linear-gradient(135deg, #ffffff 0%, #fde047 35%, #f59e0b 100%);
  border-color: #ffffff;
}

.btn-play-hero:active {
  transform: translateY(1px) scale(0.98);
}

.btn-shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-25deg);
  animation: btnShimmerSweep 3.5s infinite;
  pointer-events: none;
}

@keyframes btnShimmerSweep {
  0% {
    transform: translateX(-160%) skewX(-25deg);
  }

  35%,
  100% {
    transform: translateX(300%) skewX(-25deg);
  }
}

/* Secondary Actions Sub-Grid */
.menu-sub-grid {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.btn-sub-action {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  padding: 0 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  color: #f1f5f9;
  background: linear-gradient(180deg, rgba(20, 26, 48, 0.85) 0%, rgba(12, 16, 32, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-sub-action .ic-ngoc {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.75));
  flex: none;
}

.btn-sub-action i {
  font-size: 16px;
  color: #fde047;
  flex: none;
}

.btn-sub-action span {
  white-space: nowrap;
}

.btn-sub-action:hover {
  background: linear-gradient(180deg, rgba(35, 45, 78, 0.95) 0%, rgba(18, 25, 52, 0.98) 100%);
  border-color: #f59e0b;
  color: #fef08a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-sub-action:active {
  transform: translateY(1px) scale(0.98);
}

#btn-topup {
  border-color: rgba(56, 189, 248, 0.45);
}

#btn-topup:hover {
  border-color: #38bdf8;
  color: #bae6fd;
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.35);
}

/* 4. Bottom Stats Ribbon */
.menu-stats-ribbon {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  padding: 8px 16px;
  width: max-content;
  max-width: min(96%, 800px);
  background: rgba(10, 15, 30, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .menu-stats-ribbon {
    flex-wrap: wrap;
    width: 100%;
    max-width: 480px;
  }
}

.stat-pill-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-pill-tag.realm-tag {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}

.stat-pill-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #94a3b8;
}

.stat-pill-tag.realm-tag .stat-pill-label {
  color: #f59e0b;
}

.stat-pill-val {
  font-size: 15px;
  color: #f8fafc;
  font-family: var(--font-display);
  font-weight: 700;
}

.stat-pill-val.gold-num {
  color: #fde047;
}

.stat-pill-val.jade-num {
  color: #38bdf8;
}

/* ==========================================================================
   Mobile Landscape & Compact Screen Optimization for Main Menu
   ========================================================================== */
@media (max-height: 620px),
(max-width: 860px) {
  #main-menu.overlay {
    padding: 8px 14px !important;
  }

  /* 1. Move Userbar to Top-Left, mirroring Language Switcher at Top-Right */
  .menu-userbar-pill {
    position: fixed !important;
    top: 10px !important;
    left: 14px !important;
    margin: 0 !important;
    z-index: 100 !important;
    padding: 3px 10px !important;
    gap: 6px !important;
    border-radius: 20px !important;
    background: rgba(15, 23, 42, 0.85) !important;
  }

  .userbar-avatar {
    font-size: 11px !important;
  }

  .userbar-info {
    font-size: 11px !important;
  }

  .userbar-info b {
    font-size: 12px !important;
  }

  .userbar-logout-btn {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
    border-radius: 6px !important;
  }

  /* 2. Top-Right Language Bar adjustment */
  .lang-bar-corner {
    top: 10px !important;
    right: 14px !important;
    padding: 2px 5px !important;
  }

  .lang-btn {
    font-size: 10px !important;
    padding: 2px 7px !important;
  }

  /* 3. Main Center Content Box */
  .menu-content-epic {
    max-width: 480px !important;
    gap: 5px !important;
    padding: 0 !important;
    margin: auto !important;
  }

  /* 4. Elegant Compact Logo & Title */
  .menu-title-box {
    margin-bottom: 0 !important;
  }

  .menu-title-glow {
    width: 180px !important;
    height: 45px !important;
    filter: blur(16px) !important;
  }

  .game-title {
    font-size: clamp(24px, 4.2vw, 32px) !important;
    letter-spacing: 0.04em !important;
    line-height: 1.15 !important;
  }

  .game-subtitle {
    font-size: 10px !important;
    letter-spacing: 0.15em !important;
    margin-top: 1px !important;
  }

  /* Hide verbose slogan poem on mobile landscape to eliminate vertical overflow */
  .game-tagline {
    display: none !important;
  }

  /* 5. Compact Action Panel */
  .menu-action-panel {
    max-width: 400px !important;
    gap: 5px !important;
    margin-top: 2px !important;
  }

  /* Server Selector */
  .menu-server-bar {
    padding: 5px 12px !important;
    border-radius: 9px !important;
  }

  .srv-bar-left {
    gap: 6px !important;
  }

  .srv-badge-dot {
    width: 7px !important;
    height: 7px !important;
  }

  .srv-bar-label {
    font-size: 11px !important;
  }

  .srv-bar-name {
    font-size: 13px !important;
  }

  .srv-bar-action {
    font-size: 10.5px !important;
    padding: 2px 7px !important;
    border-radius: 6px !important;
  }

  /* Celestial Play Button */
  .btn-play-hero {
    padding: 8px 16px !important;
    font-size: 17px !important;
    border-radius: 11px !important;
    gap: 8px !important;
  }

  .btn-hero-rune {
    font-size: 12px !important;
  }

  /* Secondary Actions Grid */
  .menu-sub-grid {
    gap: 6px !important;
  }

  .btn-sub-action {
    height: 34px !important;
    font-size: 11px !important;
    border-radius: 9px !important;
    padding: 0 6px !important;
    gap: 5px !important;
  }

  .btn-sub-action .ic-ngoc {
    width: 14px !important;
    height: 14px !important;
  }

  .btn-sub-action i {
    font-size: 12px !important;
  }

  /* 6. Bottom Stats Ribbon */
  .menu-stats-ribbon {
    margin-top: 3px !important;
    padding: 3px 8px !important;
    border-radius: 9px !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    width: auto !important;
    max-width: 96% !important;
  }

  .stat-pill-tag {
    padding: 2px 7px !important;
    border-radius: 6px !important;
    gap: 0 !important;
  }

  .stat-pill-label {
    font-size: 8px !important;
    letter-spacing: 0.04em !important;
  }

  .stat-pill-val {
    font-size: 11.5px !important;
  }
}

/* ---------- Legacy Buttons ---------- */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto
}

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .02em;
  color: var(--ink);
  background: linear-gradient(180deg, #fffdf6, #efe4c9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 22px;
  cursor: pointer;
  transition: transform .12s, box-shadow .2s, background .2s;
  box-shadow: 0 3px 10px rgba(120, 92, 24, .16)
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(184, 134, 11, .38);
  background: linear-gradient(180deg, #fff, #f6eed6)
}

.btn:active {
  transform: translateY(1px) scale(.98)
}

.btn-primary {
  background: linear-gradient(180deg, #f6da84, #c9a022);
  border-color: #b8860b;
  color: #3a2c08;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .4)
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(201, 162, 39, .6);
  background: linear-gradient(180deg, #fbe49a, #d6ab2b)
}

.btn-danger {
  background: linear-gradient(180deg, #e0524f, #b91c1c);
  border-color: #b91c1c;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4)
}

.btn-danger:hover {
  box-shadow: 0 8px 24px rgba(220, 38, 38, .45)
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--gold-2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700
}

.icon-btn:hover {
  background: rgba(201, 162, 39, .2)
}

/* ---------- Settings Modal (Celestial Xianxia Design) ---------- */
#settings-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse 90% 75% at 50% 45%, rgba(10, 8, 24, 0.75) 0%, rgba(6, 4, 16, 0.94) 80%),
    url("../assets/background/main_background.webp") center/cover no-repeat,
    #0c0a18;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#settings-screen.hidden {
  display: none !important;
}

.settings-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, rgba(20, 26, 46, 0.95) 0%, rgba(11, 15, 29, 0.98) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85),
    0 0 35px rgba(245, 158, 11, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: settingsModalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes settingsModalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header */
.settings-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  width: 100%;
}

.settings-title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.5vw, 26px);
  font-weight: 800;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #ffffff 0%, #fef08a 35%, #f59e0b 80%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
}

.settings-title-rune {
  font-size: 15px;
  color: #f59e0b;
  -webkit-text-fill-color: initial;
  opacity: 0.85;
}

.settings-title .hn-cog {
  font-size: 22px;
  color: #f59e0b;
  -webkit-text-fill-color: initial;
  animation: cogSpin 14s linear infinite;
}

@keyframes cogSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.settings-subtitle {
  font-family: var(--font-body);
  font-size: 12.5px;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

/* Settings List Box */
.settings-list-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(245, 158, 11, 0.16);
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.settings-item:hover {
  background: rgba(24, 34, 60, 0.85);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.settings-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fde047;
  font-size: 16px;
  flex: none;
}

.settings-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-item-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.02em;
}

.settings-item-desc {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: #94a3b8;
}

/* Giftcode Item in Settings Screen (Stacked: Text Top, Input Bottom) */
.settings-item.settings-item-code {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.settings-item.settings-item-code .settings-item-label {
  width: 100%;
}

.settings-item.settings-item-code .settings-code-group {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.settings-item.settings-item-code .st-code-input {
  flex: 1;
  width: 100%;
}

/* Toggle Buttons */
.settings-toggle-btn.toggle {
  min-width: 72px;
  height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 17px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.75);
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.settings-toggle-btn.toggle:hover {
  border-color: rgba(148, 163, 184, 0.5);
  color: #f1f5f9;
  transform: scale(1.03);
}

.settings-toggle-btn.toggle.on {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.settings-toggle-btn.toggle.on:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 0 22px rgba(52, 211, 153, 0.65);
}

/* Language Segmented Control */
.settings-lang-switch.lang-switch-group {
  display: inline-flex;
  background: rgba(11, 15, 29, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 12px;
  padding: 3px;
  gap: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.settings-lang-switch .lang-btn {
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.settings-lang-switch .lang-btn:hover {
  color: #f1f5f9;
}

.settings-lang-switch .lang-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(217, 119, 6, 0.25) 100%);
  border-color: rgba(245, 158, 11, 0.7);
  color: #fef08a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Action Buttons */
.settings-actions {
  display: flex;
  width: 100%;
  gap: 12px;
  margin-top: 4px;
}

.btn-settings-back {
  flex: 1;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(180deg, rgba(20, 26, 48, 0.85) 0%, rgba(12, 16, 32, 0.95) 100%);
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.btn-settings-back:hover {
  border-color: #f59e0b;
  color: #fef08a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-settings-wipe {
  flex: 1.2;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  background: linear-gradient(180deg, rgba(185, 28, 28, 0.85) 0%, rgba(127, 29, 29, 0.95) 100%);
  color: #fee2e2;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(185, 28, 28, 0.3);
}

.btn-settings-wipe:hover {
  border-color: #ef4444;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.95) 0%, rgba(153, 27, 27, 1) 100%);
}

/* ---------- Pause / Game over ---------- */
#pause-screen,
#gameover-screen {
  background: rgba(240, 234, 216, .88);
  backdrop-filter: blur(4px)
}

.pause-content,
.gameover-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow)
}

.pause-stats {
  color: var(--ink-dim);
  font-size: 14px;
  margin-bottom: 22px;
  line-height: 1.8;
  font-family: var(--font-body)
}

.pause-stats b {
  color: var(--ink)
}

.go-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 6vw, 48px);
  color: var(--blood);
  text-shadow: 0 1px 2px rgba(255, 255, 255, .6);
  margin-bottom: 18px
}

.go-title.win {
  color: var(--gold-2);
  text-shadow: 0 1px 2px rgba(255, 255, 255, .7), 0 0 24px rgba(201, 162, 39, .4)
}

.go-summary {
  color: var(--ink-dim);
  font-size: 14px;
  line-height: 1.9;
  margin-bottom: 18px
}

.go-summary b {
  color: var(--ink)
}

.go-reward {
  background: rgba(201, 162, 39, .12);
  border: 1px solid rgba(184, 134, 11, .45);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 22px
}

.reward-line {
  color: var(--gold-2);
  font-weight: 700;
  font-size: 18px
}

/* ---------- Toast ---------- */
.toast-area {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none !important;
  background: transparent !important;
  background-color: transparent !important;
  width: auto;
  max-width: 100%
}

.toast {
  background: rgba(12, 10, 22, .94);
  border: 1.5px solid rgba(245, 158, 11, .7);
  border-radius: 10px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 14px;
  color: #fef08a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .85), 0 0 14px rgba(245, 158, 11, .3);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: toastIn .25s cubic-bezier(0.16, 1, 0.3, 1), toastOut .35s ease 2.2s forwards;
  max-width: min(90vw, 640px);
  text-align: center;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45
}

.toast .ic-linhthach {
  width: 18px;
  height: 18px;
  vertical-align: -2px;
  display: inline-block;
  object-fit: contain
}

.toast.gold {
  border-color: #f59e0b;
  color: #fde047;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .85), 0 0 18px rgba(245, 158, 11, .45)
}

.toast.epic {
  border-color: #a855f7;
  color: #e9d5ff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .85), 0 0 18px rgba(168, 85, 247, .45)
}

.toast.red,
.toast.err {
  border-color: #ef4444;
  color: #fca5a5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .85), 0 0 18px rgba(239, 68, 68, .45)
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(.94)
  }

  to {
    opacity: 1;
    transform: none
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(.96)
  }
}

@media (max-width:900px),
(max-height:500px) {
  .toast-area {
    top: 54px;
    gap: 4px
  }

  .toast {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 7px;
    border-width: 1px;
    gap: 5px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .8), 0 0 10px rgba(245, 158, 11, .3)
  }

  .toast .ic-linhthach {
    width: 15px;
    height: 15px;
    vertical-align: -2px
  }
}

/* ---------- Mobile controls ---------- */
#mobile-controls {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none
}

/* floating joystick: hidden until a finger presses + drags on the game; placed under it by js/input.js (left / top) */
.joystick {
  position: absolute;
  left: 0;
  top: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: none;
  background: rgba(201, 162, 39, .14);
  border: 2px solid rgba(184, 134, 11, .5);
  pointer-events: none;
  box-shadow: 0 0 0 4px rgba(10, 8, 26, .18), inset 0 0 22px rgba(242, 213, 114, .12)
}

.joystick.on {
  display: block;
  animation: joyIn .12s ease-out
}

@keyframes joyIn {
  from {
    opacity: 0;
    transform: scale(.7)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-lt), var(--gold));
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px rgba(201, 162, 39, .6)
}

/* menu floating spec (gold linh khí motes) */
.spec {
  position: absolute;
  border-radius: 50%;
  background: var(--gold-lt);
  pointer-events: none;
  animation: floatUp linear infinite
}

@keyframes floatUp {
  from {
    transform: translateY(0);
    opacity: 0
  }

  10% {
    opacity: .8
  }

  90% {
    opacity: .6
  }

  to {
    transform: translateY(-100vh);
    opacity: 0
  }
}

@media (max-width:600px) {
  .hud-left {
    max-width: 200px
  }

  .game-timer {
    font-size: 22px
  }

  .choice-cards {
    grid-template-columns: 1fr
  }

  .menu-stats {
    font-size: 11px;
    gap: 12px
  }
}

/* ---------- Pixel icons (HackerNoon Pixel Icon Library) ---------- */
.hn {
  display: inline-block;
  line-height: 1
}

.hn:before {
  vertical-align: middle
}

/* buttons & titles */
.btn .hn {
  font-size: 1.05em;
  margin-right: 4px;
  color: inherit
}

.panel-title .hn {
  font-size: .85em;
  margin: 0 6px;
  color: var(--gold-2)
}

.choice-flash .hn {
  font-size: .8em;
  margin: 0 8px;
  color: var(--gold-2)
}

.reroll-btn .hn {
  margin-right: 5px
}

/* HUD */
.currency-pill .hn {
  color: var(--gold-2);
  font-size: 15px;
  margin-right: 3px
}

.kills-counter .hn {
  color: var(--blood);
  font-size: 14px;
  margin-right: 3px
}

.icon-btn .hn {
  font-size: 15px
}

/* weapon tray */
.wpn-icon .hn {
  font-size: 22px;
  color: #4a3a12;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .6)
}

/* level-up choice cards — icon color by rarity */
.cc-icon {
  line-height: 1
}

.cc-icon .hn {
  font-size: 42px;
  color: #5a4a1a;
  text-shadow: 0 1px 6px rgba(255, 255, 255, .4)
}

.rar-rare .cc-icon .hn {
  color: var(--rare)
}

.rar-epic .cc-icon .hn {
  color: var(--epic)
}

.rar-legend .cc-icon .hn {
  color: var(--legend);
  text-shadow: 0 0 14px rgba(180, 83, 9, .35)
}

.rar-myth .cc-icon .hn {
  color: var(--myth);
  text-shadow: 0 0 14px rgba(190, 18, 60, .35)
}

/* character portrait */
.char-portrait .hn {
  font-size: 34px;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .35)
}

/* codex + meta */
.ci-icon .hn {
  font-size: 22px;
  color: var(--gold-2)
}

.meta-card h4 .hn {
  font-size: .9em;
  margin-right: 5px;
  color: var(--gold-2)
}

/* ---------- Language Switcher (i18n) ---------- */
.lang-bar-corner {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 18, 30, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 6px;
  border-radius: 20px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lang-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #c9b99a;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}

.lang-btn:hover {
  color: #fff;
  border-color: rgba(212, 175, 55, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.lang-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(184, 134, 11, 0.6));
  color: #fff;
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
}

.lang-switch-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 5px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

@media (max-width: 480px) {
  .menu-action-panel {
    max-width: 100%;
    padding: 0 8px;
  }

  .btn-sub-action {
    font-size: 12px;
    padding: 0 6px;
    gap: 5px;
    height: 44px;
  }

  .btn-sub-action .ic-ngoc {
    width: 16px;
    height: 16px;
  }

  .btn-sub-action i {
    font-size: 14px;
  }
}

/* ==========================================================================
   Mobile Landscape & Compact Optimization for Settings Screen
   ========================================================================== */
@media (max-height: 620px),
(max-width: 860px) {
  #settings-screen {
    padding: 6px !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .settings-modal-card {
    width: min(94%, 760px) !important;
    max-width: 95% !important;
    height: min(95%, 480px) !important;
    max-height: 95% !important;
    padding: 10px 16px 10px !important;
    gap: 8px !important;
    border-radius: 12px !important;
    margin: 0 !important;
  }

  /* Header */
  .settings-header {
    gap: 1px !important;
  }

  .settings-title {
    font-size: 16px !important;
    gap: 6px !important;
  }

  .settings-title-rune {
    font-size: 11px !important;
  }

  .settings-title .hn-cog {
    font-size: 14px !important;
  }

  .settings-subtitle {
    font-size: 10.5px !important;
  }

  /* Scrollable 2-Column Grid for Settings */
  .settings-list-box {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-right: 4px !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(245, 158, 11, 0.4) transparent !important;
  }

  .settings-list-box::-webkit-scrollbar {
    width: 4px !important;
  }

  .settings-list-box::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.35) !important;
    border-radius: 4px !important;
  }

  .settings-item {
    padding: 6px 10px !important;
    gap: 8px !important;
    border-radius: 8px !important;
  }

  .settings-item-label {
    gap: 8px !important;
  }

  .settings-item-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
  }

  .settings-item-name {
    font-size: 12px !important;
  }

  .settings-item-desc {
    font-size: 9.5px !important;
    line-height: 1.25 !important;
  }

  /* Giftcode spans full 2-columns for spacious input */
  .settings-item.settings-item-code {
    grid-column: 1 / -1 !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
  }

  .settings-item.settings-item-code .settings-item-label {
    width: auto !important;
    flex: 1 !important;
  }

  .settings-item.settings-item-code .settings-code-group {
    width: auto !important;
    flex: 1.2 !important;
    gap: 6px !important;
  }

  .st-code-input {
    height: 32px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  .st-code-btn {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }

  /* Controls */
  .settings-toggle-btn.toggle {
    min-width: 54px !important;
    height: 26px !important;
    font-size: 11px !important;
    padding: 0 8px !important;
  }

  .settings-lang-switch.lang-switch-group {
    padding: 2px !important;
    gap: 2px !important;
  }

  .settings-lang-switch .lang-btn {
    padding: 3px 8px !important;
    font-size: 10.5px !important;
  }

  #btn-menu-support {
    padding: 4px 10px !important;
    font-size: 11px !important;
    height: 28px !important;
  }

  /* Action Buttons */
  .settings-actions {
    gap: 8px !important;
    margin-top: 2px !important;
  }

  .btn-settings-back,
  .btn-settings-wipe {
    height: 34px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    gap: 6px !important;
  }
}

/* Narrow portrait phone (height > width, width <= 600px) */
@media (max-width: 600px) and (orientation: portrait) {
  .settings-list-box {
    grid-template-columns: 1fr !important;
  }

  .settings-item.settings-item-code {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .settings-item.settings-item-code .settings-code-group {
    width: 100% !important;
  }
}

/* Master override for forced-landscape on mobile: enforce percentage sizing so transform: rotate(90deg) scales properly */
body.forced-landscape .vodanh-window,
body.forced-landscape .tournament-window,
body.forced-landscape .luanvo-window,
body.forced-landscape .al-window,
body.forced-landscape .mkt-window,
body.forced-landscape .cr-window,
body.forced-landscape .dng-window,
body.forced-landscape .kp-window,
body.forced-landscape .dash-window,
body.forced-landscape .shop-panel,
body.forced-landscape .social-panel,
body.forced-landscape .notice-panel,
body.forced-landscape .showcase-container,
body.forced-landscape .settings-modal-card,
body.forced-landscape .topup-modal-container,
body.forced-landscape .about-game-content,
body.forced-landscape .newbie-guide-panel {
  width: min(98%, 940px) !important;
  max-width: 98% !important;
  height: min(98%, 680px) !important;
  max-height: 98% !important;
}

body.forced-landscape .bt-window {
  width: min(98%, 520px) !important;
  max-width: 98% !important;
  max-height: min(98%, 560px) !important;
}

/* ---------- Mobile Auto-Rotate Hint Banner ---------- */
.rotate-hint-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(11, 15, 29, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.6);
  border-radius: 30px;
  padding: 8px 16px;
  color: #fef08a;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 18px rgba(245, 158, 11, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  animation: hintSlideDown 0.35s ease;
  pointer-events: auto;
  max-width: 94vw;
  box-sizing: border-box;
}

body.forced-landscape .rotate-hint-banner {
  max-width: min(92%, 520px);
  top: 10px;
}

.rotate-hint-banner .rh-content {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rotate-hint-banner .rh-icon {
  font-size: 16px;
  color: #f59e0b;
  flex: none;
  animation: hintSpin 3s linear infinite;
}

@keyframes hintSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotate-hint-banner .rh-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rotate-hint-banner .rh-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
  flex: none;
  transition: all 0.2s ease;
}

.rotate-hint-banner .rh-close:hover {
  background: rgba(239, 68, 68, 0.6);
  color: #fff;
  border-color: #ef4444;
}

@keyframes hintSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}