*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}

:root {
  --bg: #0f1115;
  --bg2: #16191f;
  --bg3: #1d2128;
  --bg4: #2b323c;
  --text: #f0f4f8;
  --text2: #bcc6d4;
  --text3: #75869c;
  --accent: #5eb0f9;
  --accent2: #3a7ecd;
  --red: #e06c75;
  --green: #98c379;
  --gold: #e5c07b;
  --glass: rgba(255, 255, 255, 0.05);
  --glass2: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.12);
  --border-glow: 0 0 8px rgba(255, 255, 255, 0.05);
  --border-gradient: none;
  --node-text: #ffffff;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden
}

body {
  display: flex;
  flex-direction: column
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh
}

.theme-bg {
  background-color: var(--bg3);
  background-image: var(--theme-bg-img);
  background-size: cover;
  background-position: center;
  background-attachment: scroll;
  background-blend-mode: var(--theme-blend);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px 10px 12px;
  border-bottom: 2px solid var(--border);
  border-image-source: var(--border-gradient, none);
  border-image-slice: 1;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: borderGlow 3s ease-in-out infinite alternate;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1;
}

.title-icon {
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

header .game-num {
  color: var(--text3);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--glass);
  border-radius: 6px
}

header .new-game-btn {
  background: var(--glass2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: all .2s
}

header .new-game-btn:hover {
  background: var(--glass);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(94, 176, 249, 0.15)
}

header #lb-open-btn {
  background: var(--glass2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

header #lb-open-btn:hover {
  background: var(--glass);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(94, 176, 249, 0.15);
  transform: translateY(-1px);
}

header #lb-open-btn span {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.points-btn {
  background: rgba(229, 192, 123, 0.1);
  border: 1px solid rgba(229, 192, 123, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
}

.points-btn:hover {
  background: rgba(229, 192, 123, 0.2);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 192, 123, 0.2);
}

.points-btn .not-signed-in {
  font-size: 0.7rem;
  opacity: 0.8;
  font-weight: 600;
  color: var(--text3);
}

#nav-hamburger-btn {
  background: var(--glass2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all .2s;
}

#nav-hamburger-btn:hover,
#nav-hamburger-btn.active {
  background: var(--glass);
  border-color: var(--accent);
  color: var(--accent);
}

/* Sakura Petal Particles */
.sakura-particle {
  position: absolute;
  pointer-events: none;
  border-radius: 40% 60% 50% 50%;
  z-index: 5;
  filter: blur(0.5px);
}

@keyframes sakuraDrift {
  0% {
    transform: translateY(-20px) translateX(0) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.8;
  }

  90% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(110vh) translateX(200px) rotate(720deg);
    opacity: 0;
  }
}

@keyframes sakuraSway {

  0%,
  100% {
    margin-left: 0;
  }

  50% {
    margin-left: 50px;
  }
}

/* (.bg-tree_bloom and .bg-tree_sakura_petals removed — referenced non-existent image files.
   Tree backgrounds are now applied via a dynamic <style> tag in JS with correct URL resolution.)
   Sakura animated petals are provided by the JS particle system instead. */

/* Gold Edition Glint Animation */
.bg-tree_gold_edition::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.3) 45%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0.3) 55%, transparent 65%);
  background-size: 300% 100%;
  animation: goldGlint 8s infinite ease-in-out;
  z-index: -1;
  pointer-events: none;
}

@keyframes goldGlint {
  0% { background-position: 150% 0; }
  15% { background-position: -150% 0; }
  100% { background-position: -150% 0; }
}




/* Orion Dynamic Sub-Stars */
.orion-star {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  will-change: opacity, transform;
}

@keyframes starFlash {
  0%, 90%, 100% {
    opacity: 0;
    transform: scale(0.5);
  }
  95% {
    opacity: 1;
    transform: scale(1.2);
  }
}

#nav-dropdown {
  display: none;
  position: absolute;
  top: 52px;
  right: 12px;
  background: var(--bg3);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  min-width: 170px;
  flex-direction: column;
  gap: 6px;
  animation: dropdownPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#nav-dropdown.show {
  display: flex;
}

@keyframes dropdownPop {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

main {
  display: flex;
  flex: 1;
  overflow: hidden
}

/* LEFT PANEL */
#left-panel {
  width: 380px;
  min-width: 340px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border);
  border-image: var(--border-gradient) 1;
  background: transparent;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  order: 1;
  position: relative;
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  animation: borderGlow 3s ease-in-out infinite alternate
}

#left-panel::-webkit-scrollbar {
  width: 6px
}

#left-panel::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px
}

#left-panel::-webkit-scrollbar-track {
  background: transparent
}

#tree-container {
  order: 2;
  position: relative;
  flex: 1;
  overflow: visible;
  background-color: #0d1117;
  background-position: center;
  background-repeat: no-repeat;
  transition: background 0.5s ease;
}

/* Mobile optimization for Scientific Isogrid scaling */
@media (max-width: 600px) {
  #tree-container.bg-tree_bloom {
    background-size: 850px auto !important;
  }
}

#guess-section {
  padding: 20px;
  border-bottom: 2px solid var(--border);
  border-image: var(--border-gradient, none) 1;
  animation: borderGlow 3s ease-in-out infinite alternate;
  flex-shrink: 0;
  background-color: var(--bg3);
}

#guess-section label {
  font-size: 0.9rem;
  color: var(--text2);
  margin-bottom: 4px;
  display: block;
  font-weight: 500
}

#guess-section .remaining {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  margin-left: 8px
}

#input-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  position: relative
}

#guess-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box, var(--border-gradient) border-box;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all .2s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#guess-input:focus {
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--border-gradient) border-box;
  box-shadow: 0 0 0 3px rgba(94, 176, 249, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  animation: pulse 2s infinite;
}

#guess-input::placeholder {
  color: var(--text3);
  opacity: 0.7;
}

#guess-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 176, 249, 0.12), inset 0 2px 4px rgba(0, 0, 0, 0.2);
  background: var(--bg)
}

#guess-btn {
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--bg3);
  color: var(--text);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

#guess-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(94, 176, 249, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  border-color: var(--accent2);
  background: var(--bg2);
}

#guess-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  border-color: var(--border)
}

#autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 60px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none
}

#autocomplete .ac-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .15s
}

#autocomplete .ac-item:hover,
#autocomplete .ac-item.active {
  background: var(--glass2);
  color: var(--accent)
}

#autocomplete .ac-item .sci {
  color: var(--text3);
  font-style: italic;
  margin-left: 6px;
  font-size: 0.8rem
}

#countdown {
  font-size: 0.75rem;
  color: var(--text3);
  font-family: 'Courier New', monospace
}

.share-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--glass2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  transition: all .2s;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
  transform: translateY(-1px);
}

#win-msg {
  display: none;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--glass2);
  border: var(--inner-border, 1px solid var(--border));
  border-image-source: var(--border-gradient, none);
  border-image-slice: 1;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#win-msg h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 4px
}

#win-msg p {
  color: var(--text2);
  font-size: 0.85rem
}

/* WIKI PANEL */
#wiki-panel {
  padding: 0 20px 80px;
  background: transparent;
}

#how-to-play {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px
}

#how-to-play details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text2);
}

#how-to-play summary {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: block;
  background: var(--glass2);
  transition: background .2s;
  outline: none;
  user-select: none;
}

#how-to-play summary:hover {
  background: var(--glass)
}

#how-to-play summary::-webkit-details-marker {
  display: none
}

#how-to-play .details-content {
  padding: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--bg3);
  border-top: 1px solid var(--border)
}

#how-to-play ul {
  padding-left: 20px;
  margin-top: 8px
}

#how-to-play li {
  margin-bottom: 6px
}

.news-entry {
  padding: 15px;
  background: var(--glass2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.modal-header .icon {
  font-size: 1.8rem;
  margin-right: 10px;
}

.news-date {
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.news-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.news-entry p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.5;
  margin: 0;
}

#wiki-panel::-webkit-scrollbar-thumb {
  background: var(--glass2);
  border-radius: 3px
}

.wiki-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  animation: fadeIn .3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
  transition: all .3s ease;
}

.wiki-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  border-color: var(--accent);
}

.wiki-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent2), var(--accent))
}

.wiki-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.2px
}

.wiki-card .wiki-sub {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 10px;
  font-style: italic
}

.wiki-card p {
  color: var(--text2);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 12px
}

.wiki-card img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
  max-height: 220px;
  object-fit: cover
}

.wiki-card a {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none
}

.wiki-card a:hover {
  text-decoration: underline
}

.wiki-placeholder {
  text-align: center;
  color: var(--text3);
  padding: 40px 20px;
  font-size: 0.9rem
}

.wiki-placeholder .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block
}

.common-animals {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border)
}

.common-animals h3 {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px
}

.common-animals ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px
}

.common-animals li {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--glass2);
  color: var(--text2);
  border: 1px solid var(--border);
  text-transform: capitalize
}

/* GUESS LIST */
#guess-list {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px
}

.guess-tag {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid;
  font-weight: 600;
  background: var(--glass2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all .2s;
  cursor: default
}

.guess-tag:hover {
  filter: brightness(1.2)
}

/* TREE */
#tree-container {
  flex: 1;
  overflow: hidden;
  touch-action: none;
  position: relative;
  background-color: transparent;
  order: 2;
  z-index: 0;
}

#tree-container::before {
  content: '';
  position: fixed;
  inset: -50px;
  background-color: #15171c; /* default fallback; overridden per-cosmetic by JS dynamic style */
  background-image: none;
  background-size: auto;
  background-position: 0 0;
  z-index: -2;
  pointer-events: none;
  animation: tree-bg-drift 40s ease-in-out infinite alternate;
}

@keyframes tree-bg-drift {
  0% {
    transform: scale(1) translate(0, 0);
  }

  100% {
    transform: scale(1.05) translate(10px, 10px);
  }
}

.disco-active::before {
  animation: discoAnim 1.5s steps(6) infinite !important;
}

@keyframes discoAnim {
  0% {
    filter: hue-rotate(0deg) brightness(1);
  }

  50% {
    filter: hue-rotate(180deg) brightness(1.5);
  }

  100% {
    filter: hue-rotate(360deg) brightness(1);
  }
}

@keyframes stardustAnim {

  0%,
  100% {
    opacity: 0.9;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes stardustFall {
  from {
    background-position: 0px 0px, 0px 0px, 0px 0px, 0px 0px;
  }

  to {
    background-position: 600px 600px, 1200px 1200px, 600px 1800px, 1200px 600px;
  }
}

#tree-container.stars-active::before {
  animation: stardustFall 35s linear infinite, stardustAnim 4s ease-in-out infinite, tree-bg-drift 40s ease-in-out infinite alternate;
}

@keyframes fireworksPop {
  0% {
    opacity: 0;
    transform: scale(0.8);
    filter: brightness(2);
  }

  10% {
    opacity: 1;
    transform: scale(2.0);
    filter: brightness(1.5);
  }

  40% {
    opacity: 1;
    transform: scale(1.5);
    filter: brightness(1);
  }

  100% {
    opacity: 0;
    transform: scale(2.5);
    filter: blur(5px);
  }
}

#tree-container.fireworks-active::before {
  animation: fireworksPop 3s ease-out infinite;
}

#tree-container.fireworks-active::after {
  display: none;
}

#tree-svg {
  width: 100%;
  height: 100%;
  display: block
}

.tree-node {
  cursor: pointer;
  transition: all .3s;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3))
}

.tree-node:hover {
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(94, 176, 249, 0.25))
}

/* MODAL */
.modal-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 10px;
  overflow-y: auto;
  animation: fadeIn .2s
}

.modal {
  position: relative;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
  margin: auto;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #a3d4ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent
}

.modal .stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 16px 0
}

.modal .stat {
  text-align: center
}

.modal .stat .val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text)
}

.modal .stat .lbl {
  font-size: 0.75rem;
  color: var(--text3)
}

.modal .modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px
}

.modal .modal-btns button {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all .2s
}

.modal .btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000
}

.modal .btn-secondary {
  background: var(--glass2);
  color: var(--text);
  border: 1px solid var(--border)
}

.modal .close-btn,
#lb-modal .close-btn,
#htp-modal .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  min-width: 48px;
  min-height: 34px;
}

.modal .close-btn:hover {
  background: var(--glass);
  color: var(--text);
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
}

/* GAME OVER BANNERS */
#win-banner-overlay,
#loss-banner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  overflow-y: auto;
  animation: fadeIn .3s
}

#win-banner-overlay.show,
#loss-banner-overlay.show {
  display: flex
}

#win-banner,
#loss-banner {
  background: var(--bg2);
  border: var(--inner-border, 1px solid var(--border));
  border-image-source: var(--border-gradient, none);
  border-image-slice: 1;
  border-radius: 20px;
  padding: 36px 32px 28px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
  animation: bannerPop .35s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes bannerPop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px)
  }

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

#win-banner h2,
#loss-banner h2 {
  font-size: 2.22rem;
  font-weight: 800;
  margin: 0 0 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

#win-banner .banner-subtitle,
#loss-banner .banner-subtitle {
  font-size: 0.9rem;
  color: var(--text2);
  margin-bottom: 24px;
  font-weight: 500;
}

.banner-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 0 0 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden
}

.banner-stat-group {
  flex: 1;
  padding: 14px 8px;
  border-right: 1px solid var(--border)
}

.banner-stat-group:last-child {
  border-right: none
}

.banner-stat-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
  margin-bottom: 10px
}

.banner-stat-row {
  display: flex;
  justify-content: center;
  gap: 16px
}

.banner-stat {
  display: flex;
  flex-direction: column;
  align-items: center
}

.banner-stat .val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1
}

.banner-stat .lbl {
  font-size: 0.68rem;
  color: var(--text3);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em
}

#win-banner .banner-share-btn,
#loss-banner .banner-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--glass2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 18px
}

#win-banner .banner-share-btn:hover,
#loss-banner .banner-share-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

#win-banner .banner-credit,
#loss-banner .banner-credit {
  font-size: 0.72rem;
  color: var(--text3);
  line-height: 1.5
}

#win-banner .banner-credit a,
#loss-banner .banner-credit a {
  color: var(--accent);
  text-decoration: underline
}

/* LOSS BANNER SPECIFIC */
.loss-banner h2 {
    background: linear-gradient(135deg, var(--red), #ff9a9e) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

.loss-banner .banner-stat-group-label {
    color: var(--red) !important;
}

.loss-banner #loss-answer-box {
    margin: 18px 0;
    padding: 18px;
    background: rgba(224, 108, 117, 0.08);
    border-radius: 16px;
    border: 1px solid rgba(224, 108, 117, 0.2);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease;
}

.loss-banner #loss-answer-box div:first-child {
    font-size: 0.7rem;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 6px;
}

.loss-banner #loss-answer-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.2px;
}

/* XP SYSTEM UI */
.level-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--accent);
  padding: 5px 10px;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.level-badge:hover {
  background: rgba(94, 176, 249, 0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.level-label {
  font-size: 0.65rem;
  color: var(--text3);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.level-val {
  color: var(--accent);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
}

.xp-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text2);
  background: var(--bg3);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-left: 4px;
}

@keyframes levelUpPulse {
  0% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 0 var(--accent));
  }

  50% {
    transform: scale(1.2);
    filter: brightness(1.5) drop-shadow(0 0 15px var(--accent));
  }

  100% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 0 var(--accent));
  }
}

.level-up-anim {
  animation: levelUpPulse 0.8s ease-in-out 3;
}

.xp-earned-banner {
  background: var(--glass2);
  border-radius: 12px;
  padding: 10px 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px dashed var(--accent);
  margin-bottom: 12px;
}

/* STATS MODAL & PROGRESS BAR */
#stats-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 900;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 10px;
  overflow-y: auto;
  animation: fadeIn 0.2s;
}

.card {
  background: var(--bg2);
  border: var(--inner-border, 1px solid var(--border));
  border-image-source: var(--border-gradient, none);
  border-image-slice: 1;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#stats-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 95%;
  max-width: 420px;
  padding: 32px 24px;
  position: relative;
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
  max-height: 90vh;
  overflow-y: auto;
}

.progress-container {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 7px;
  overflow: hidden;
  margin-top: 12px;
  border: 1px solid var(--border);
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.xp-text {
  font-size: 0.7rem;
  color: var(--text3);
  margin-top: 6px;
  text-align: center;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 24px;
}

.stats-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 4px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}

.stats-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stats-card .val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  display: block;
  line-height: 1.1;
}

.stats-card .lbl {
  font-size: 0.62rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 6px;
  font-weight: 700;
}



#win-banner .banner-close,
#loss-banner .banner-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px
}

#win-banner .banner-close:hover,
#loss-banner .banner-close:hover {
  color: var(--text)
}

/* LEADERBOARD BUTTON */
.lb-btn {
  background: var(--glass2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  transition: all .2s;
}

.lb-btn:hover {
  background: var(--glass);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(94, 176, 249, 0.15)
}

.shop-item,
.inv-item {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 14px 16px !important;
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  margin-bottom: 12px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background: var(--bg2);
  position: relative;
  overflow: hidden;
  text-align: left !important;
  box-sizing: border-box;
}

.shop-item > div:first-child,
.inv-item > div:first-child {
  flex-grow: 1;
  text-align: left;
}

.shop-item > div:last-child,
.inv-item > div:last-child {
  margin-left: 12px;
  flex-shrink: 0;
}

.shop-item:hover,
.inv-item:hover {
  border-color: var(--accent) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 243, 255, 0.05);
}

.buy-btn, .equip-btn {
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 0.9rem;
}

.buy-btn:hover, .equip-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--glass2);
}

.buy-btn.confirming {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
  background: rgba(94, 176, 249, 0.1) !important;
  animation: confirm-pulse 1s infinite alternate !important;
}

@keyframes confirm-pulse {
  from { transform: scale(1); box-shadow: 0 0 5px rgba(94, 176, 249, 0.2); }
  to { transform: scale(1.05); box-shadow: 0 0 15px rgba(94, 176, 249, 0.5); }
}

.inv-item.active {
  border-color: var(--accent) !important;
  background-color: rgba(94, 176, 249, 0.1) !important;
}

.equip-btn:disabled {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--glass);
  cursor: default;
  opacity: 0.8;
}

/* LEADERBOARD MODAL */
#lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 600;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 10px;
  overflow-y: auto;
  animation: fadeIn .2s
}

#lb-overlay.show {
  display: flex
}

#lb-modal {
  background: linear-gradient(145deg, var(--bg3), var(--bg2));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 0;
  max-width: 520px;
  width: 94%;
  max-height: 85vh;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  position: relative;
  animation: bannerPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

#lb-modal .lb-header {
  padding: 28px 28px 0;
  text-align: center;
  flex-shrink: 0
}

#lb-modal .lb-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 4px;
  background: linear-gradient(135deg, var(--accent), #a3d4ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent
}

#lb-modal .lb-header p {
  font-size: 0.82rem;
  color: var(--text3);
  margin: 0 0 16px
}

#lb-modal .lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text3);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

#lb-modal .lb-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: var(--accent);
  transform: scale(1.1);
}

@media (max-width: 500px) {
  #lb-modal {
    padding: 40px 16px 20px;
    width: 95vw;
  }

  .lb-header h2 {
    font-size: 1.6rem !important;
  }

  .lb-tabs {
    width: 100% !important;
    gap: 2px !important;
  }

  .lb-tab {
    padding: 7px 8px !important;
    font-size: 0.72rem !important;
    min-width: 0 !important;
  }
}

.lb-tabs {
  display: flex;
  background: var(--bg2);
  border-radius: 12px;
  padding: 3px;
  margin: 0 auto 20px;
  width: fit-content;
  min-width: 280px;
  max-width: calc(100% - 32px);
  border: 1px solid var(--border);
  box-sizing: border-box;
  gap: 3px;
  position: relative;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.2);
}

.lb-tab {
  flex: 1;
  min-width: unset;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  z-index: 1;
  letter-spacing: -0.1px;
  position: relative;
}

.lb-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.25s;
}

.lb-tab:hover:not(.active) {
  color: var(--text2);
}

.lb-tab:hover:not(.active) svg {
  opacity: 0.75;
}

.lb-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 2px 8px rgba(94, 176, 249, 0.3);
}

.lb-tab.active svg {
  opacity: 1;
}

.lb-profile-btn {
  display: none;
}

/* removing old absolute button */

.lb-footer {
  flex-shrink: 0;
  padding: 18px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  border-radius: 0 0 calc(var(--radius) * 1.5) calc(var(--radius) * 1.5);
  display: flex;
  gap: 12px;
}

.lb-footer-btn {
  flex: 1;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lb-footer-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.lb-footer-btn.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(var(--accent-rgb, 94, 176, 249), 0.3);
}

.lb-footer-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
}



/* HOW TO PLAY MODAL */
#htp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 600;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 10px;
  overflow-y: auto;
  animation: fadeIn .2s;
}

#htp-overlay.show {
  display: flex;
}

#htp-modal {
  background: linear-gradient(145deg, var(--bg3), var(--bg2));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  position: relative;
  animation: bannerPop .3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
}

#htp-modal h2 {
  margin-top: 0;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 1.6rem;
  font-weight: 800;
}

.htp-close {
  /* Legacy class, now aliases to close-btn styles if needed */
  position: absolute;
  top: 16px;
  right: 16px;
}

/* Leaderboard content */
.lb-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px 28px;
  scrollbar-width: thin
}

.lb-content::-webkit-scrollbar {
  width: 5px
}

.lb-content::-webkit-scrollbar-thumb {
  background: var(--glass2);
  border-radius: 3px
}

/* Username input area */
.lb-username-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  align-items: center
}

.lb-username-bar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color .2s
}

.lb-username-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 176, 249, 0.12)
}

button:not(.nav-item) {
  padding: 12px 24px;
  border: var(--inner-border, 1px solid var(--border));
  background-image: var(--border-gradient, none);
  background-clip: padding-box;
  background-color: var(--bg3);
  color: var(--text);
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
}

button:hover:not(.nav-item) {
  filter: brightness(1.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lb-username-bar button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none
}

/* Table */
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem
}

.lb-table thead th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border)
}

.lb-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s
}

.lb-table tbody tr:hover {
  background: var(--glass2)
}

.lb-table td {
  padding: 12px 10px;
  color: var(--text2)
}

.lb-table .rank {
  font-weight: 800;
  width: 40px;
  text-align: center
}

.lb-table .rank-1 {
  color: #ffd700;
  font-size: 1.1rem
}

.lb-table .rank-2 {
  color: #c0c0c0;
  font-size: 1.05rem
}

.lb-table .rank-3 {
  color: #cd7f32;
  font-size: 1rem
}

.lb-table .player-name {
  font-weight: 600;
  color: var(--text)
}

.lb-table .player-you {
  color: var(--accent);
  font-weight: 700
}

.lb-name-hover {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  padding: 2px 0;
  border-bottom: 1.5px dashed transparent;
}

.lb-name-hover:hover {
  opacity: 0.85;
  transform: translateX(4px);
  border-bottom-color: var(--accent);
}

.lb-table .streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 100, 0, 0.12);
  color: #ff6a00;
  font-weight: 700;
  font-size: 0.78rem
}

/* Empty state */
.lb-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 0.88rem
}

.lb-empty .icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 12px
}

/* My stats card in leaderboard */
.lb-my-stats .stat-card {
  background: var(--glass2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  flex: 1;
  text-align: center;
}

.lb-my-stats {
  background: linear-gradient(135deg, var(--accent-alpha), rgba(94, 176, 249, 0.04));
  border: 1px solid var(--accent-alpha);
  border-radius: 14px;
  padding: 16px 8px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-around;
  gap: 4px
}

.lb-my-stats .ms {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  text-align: center;
}

.lb-my-stats .ms .mv {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1
}

.lb-my-stats .ms .ml {
  font-size: 0.68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px
}

.lb-status-msg {
  text-align: center;
  font-size: 0.78rem;
  color: var(--green);
  margin-top: 8px;
  min-height: 18px
}

/* Google Sign-In */
.lb-auth-section {
  margin-bottom: 18px;
  text-align: center
}

.lb-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #3c4043;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
}

.lb-google-btn:hover {
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border-color: var(--accent);
}

.lb-google-btn img {
  width: 18px;
  height: 18px;
}

.lb-user-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(94, 176, 249, 0.12), rgba(94, 176, 249, 0.04));
  border: 1px solid var(--accent);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.lb-user-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.lb-user-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 10px rgba(94, 176, 249, 0.3);
  object-fit: cover;
}

.lb-user-card .uinfo {
  flex: 1;
  text-align: left;
}

.lb-user-card .uname {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.lb-user-card .usync {
  font-size: 0.7rem;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.lb-signout-btn {
  background: var(--glass2);
  border: 1px solid var(--border);
  color: var(--text3);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lb-signout-btn:hover {
  color: var(--red);
  border-color: var(--red);
  background: rgba(224, 108, 117, 0.1);
}

.lb-auth-header {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-auth-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.3;
}

.lb-username-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.lb-username-bar input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lb-username-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 176, 249, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
  background: var(--bg);
}

.lb-save-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0 15px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(94, 176, 249, 0.3);
}

.lb-save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(94, 176, 249, 0.4);
  filter: brightness(1.1);
}

.lb-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.lb-auth-divider .line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.lb-auth-divider .text {
  font-size: 0.6rem;
  color: var(--text3);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 1px;
}

.lb-profile-info {
  text-align: center;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--glass2);
  border-radius: 16px;
  border: 1px dashed var(--border);
  position: relative;
}

.lb-profile-info .icon {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
  filter: drop-shadow(0 0 8px var(--accent));
}

.lb-profile-info h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.lb-profile-info p {
  font-size: 0.8rem;
  color: var(--text3);
  margin: 0;
  line-height: 1.4;
}

.lb-remove-section {
  border-top: 1px dashed var(--border);
  padding-top: 20px;
  margin-top: 8px;
}

.lb-remove-label {
  font-size: 0.7rem;
  color: var(--text3);
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lb-remove-bar {
  display: flex;
  gap: 6px;
}

.lb-remove-bar input {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-family: inherit;
}

.lb-remove-btn {
  flex-shrink: 0;
  background: var(--red);
  color: white;
  border: none;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.lb-remove-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}


.lb-loading {
  text-align: center;
  padding: 30px;
  color: var(--text3);
  font-size: 0.85rem
}

.lb-loading .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-bottom: 8px
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

.name-container {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-weight: 700;
  border: 2px solid transparent;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  vertical-align: middle;
  line-height: 1.2;
}

.fire-border-fix {
  overflow: visible !important;
  filter: drop-shadow(0 0 8px #ff4500) drop-shadow(0 0 18px #ff0000) !important;
}

.border_none {
  border: 2px solid transparent;
  background: none;
  box-shadow: none;
}

.border_rainbow {
  border: 2px solid transparent !important;
  position: relative;
  background: none !important;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
}

.border_rainbow::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  width: 400%;
  aspect-ratio: 1 / 1;
  background: conic-gradient(#ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000);
  animation: rotate-rainbow 4s linear infinite;
  z-index: -1;
}

.border_rainbow::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--bg2);
  border-radius: 6px;
  z-index: -1;
}

@keyframes rotate-rainbow {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(-360deg); }
}

.border_galaxy {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(135deg, #0f0c29, #302b63, #24243e, #6a11cb, #2575fc) border-box;
  background-size: 300% 300%;
  animation: galaxy-move 8s ease infinite;
  box-shadow: 0 0 15px rgba(106, 17, 203, 0.4);
  overflow: visible !important;
}

.border_galaxy::after {
  content: "";
  position: absolute;
  inset: -4px;
  background: radial-gradient(circle at center, rgba(106, 17, 203, 0.2), transparent);
  pointer-events: none;
  z-index: -1;
}

.border_prismatic {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(45deg, #00d2ff, #3a7bd5, #00d2ff, #3a7bd5) border-box;
  background-size: 200% 200%;
  animation: prismatic-shimmer 4s ease infinite;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.border_lime {
  border: 2px solid #32ff7e;
  box-shadow: 0 0 8px #32ff7e, inset 0 0 4px #32ff7e;
  background: rgba(50, 255, 126, 0.05);
  animation: lime-flicker 2s infinite alternate;
}

.border_coral {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(to right, #ff9966, #ff5e62) border-box;
  box-shadow: 0 4px 10px rgba(255, 94, 98, 0.2);
}

.border_chrome {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(135deg, #717171 0%, #c0c0c0 20%, #ffffff 40%, #c0c0c0 60%, #717171 80%, #ffffff 100%) border-box;
  background-size: 400% 400%;
  animation: chrome-shine 5s linear infinite;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.border_inferno {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(0deg, #ff4d00, #ff8c00, #ff4d00) border-box;
  background-size: 100% 200%;
  animation: inferno-flow 2s linear infinite;
  box-shadow: 0 0 12px rgba(255, 77, 0, 0.5);
}

.border_void {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(135deg, #000000, #1a1a1a, #0d001a, #4a00e0) border-box;
  background-size: 300% 300%;
  animation: galaxy-move 10s ease infinite;
  box-shadow: 0 0 15px rgba(74, 0, 224, 0.3), inset 0 0 10px rgba(0, 0, 0, 1);
}

.border_cyberpunk {
  border: 2px solid #00f3ff;
  box-shadow: 3px 3px 0px #ff003c, -2px -2px 0px #00f3ff;
  animation: cyberpunk-glitch 4s infinite;
  background: rgba(0, 243, 255, 0.05);
}

.border_golden_glory {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(110deg, #bf953f, #fcf6ba, #ffffff, #fcf6ba, #bf953f) border-box;
  background-size: 200% auto;
  animation: chrome-shine 3s linear infinite;
  box-shadow: 0 4px 15px rgba(191, 149, 63, 0.4);
}

.border_botanical {
  border: 2px solid #2ecc71;
  border-radius: 12px 4px 12px 4px;
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), transparent);
  box-shadow: inset 0 0 10px rgba(46, 204, 113, 0.1);
}

.border_olympian {
  border: none !important;
  position: relative;
  background: linear-gradient(rgba(30, 30, 35, 0.92), rgba(30, 30, 35, 0.92)),
    url('https://www.transparenttextures.com/patterns/marble-similar.png');
  padding: 6px 16px !important;
  margin: 18px 12px 10px;
  display: inline-block;
  overflow: visible !important;
  transform-style: preserve-3d;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  font-size: 0.95rem;
  border-radius: 2px;
  z-index: 5;
}

/* THE GOLDEN ARCH */
.border_olympian::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 40px;
  border: 4px solid #ffd700;
  border-bottom: none;
  border-radius: 50px 50px 0 0;
  background: linear-gradient(to right, transparent, rgba(255, 215, 0, 0.1), transparent);
  box-shadow: 0 -2px 10px rgba(255, 215, 0, 0.3);
  z-index: -1;
}

/* THE DORIC COLUMNS & VINES */
.border_olympian::after {
  content: "";
  position: absolute;
  inset: -8px -18px;
  background:
    /* --- GREEN VINES --- */
    radial-gradient(circle at 20% 100%, #2d5a27 0%, transparent 25%),
    radial-gradient(circle at 40% 95%, #3d7a35 0%, transparent 20%),
    radial-gradient(circle at 60% 105%, #2d5a27 0%, transparent 30%),
    radial-gradient(circle at 80% 90%, #3d7a35 0%, transparent 25%),

    /* --- LEFT COLUMN --- */
    linear-gradient(#e8decb, #bfae8e) 0% 0% / 18px 5px no-repeat,
    radial-gradient(farthest-side at 50% 100%, #e8decb, #d1c3a7) 1px 5px / 16px 4px no-repeat,
    linear-gradient(to right, #bfae8e, #e8decb 25%, #f7f1e6 50%, #e8decb 75%, #bfae8e) 3px 9px / 12px calc(100% - 14px) no-repeat,
    linear-gradient(#bfae8e, #e8decb) 0% 100% / 18px 5px no-repeat,

    /* --- RIGHT COLUMN --- */
    linear-gradient(#e8decb, #bfae8e) 100% 0% / 18px 5px no-repeat,
    radial-gradient(farthest-side at 50% 100%, #e8decb, #d1c3a7) calc(100% - 1px) 5px / 16px 4px no-repeat,
    linear-gradient(to right, #bfae8e, #e8decb 25%, #f7f1e6 50%, #e8decb 75%, #bfae8e) calc(100% - 3px) 9px / 12px calc(100% - 14px) no-repeat,
    linear-gradient(#bfae8e, #e8decb) 100% 100% / 18px 5px no-repeat;

  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
  z-index: 6;
  pointer-events: none;
}

/* GOLDEN ACCENTS (The Capitals) */
.border_olympian span {
  position: relative;
  z-index: 2;
}

/* PHOENIX EMBER BORDER */
.border_phoenix {
  border: 2px solid transparent;
  background: linear-gradient(var(--bg2), var(--bg2)) padding-box,
    linear-gradient(0deg, #e25822, #ff8c00, #ff0000, #ff8c00, #e25822) border-box;
  background-size: 100% 200%;
  animation: inferno-flow 1.5s linear infinite, phoenix-flicker 0.1s infinite alternate;
  box-shadow: 0 0 15px rgba(226, 88, 34, 0.6), inset 0 0 12px rgba(255, 77, 0, 0.2);
  position: relative;
  overflow: visible !important;
}

.border_phoenix::before,
.border_phoenix::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ffcc33;
  border-radius: 50%;
  filter: blur(1px);
  box-shadow: 0 0 8px #ff4500, 0 0 12px #ff0000;
  animation: phoenix-ember-pop 1.8s infinite ease-out;
  pointer-events: none;
  z-index: 10;
}

.border_phoenix::before {
  top: -8px;
  left: 20%;
}

.border_phoenix::after {
  bottom: -8px;
  right: 20%;
  animation-delay: 0.9s;
}

/* FLAME OVERLAY */
.border_phoenix span::before {
  content: "";
  position: absolute;
  inset: -4px;
  background: radial-gradient(ellipse at bottom, rgba(255, 69, 0, 0.2) 0%, transparent 70%);
  animation: phoenix-aura 2s ease-in-out infinite alternate;
  z-index: -1;
  pointer-events: none;
}

@keyframes phoenix-flicker {
  0% { opacity: 0.92; filter: brightness(1); }
  100% { opacity: 1; filter: brightness(1.25); }
}

.phoenix-text {
  background-size: 200% auto !important;
  animation: fire-pan-anim 1.5s linear infinite, phoenix-flicker 0.15s infinite alternate !important;
  font-weight: 800 !important;
}

}

@keyframes phoenix-aura {
  0% { transform: scale(1) translateY(0); filter: blur(2px); }
  100% { transform: scale(1.1) translateY(-3px); filter: blur(4px); }
}

@keyframes phoenix-ember-pop {
  0% { transform: scale(0) translateY(0) translateX(0); opacity: 0; }
  25% { transform: scale(1.5) translateY(-10px) translateX(2px); opacity: 0.9; }
  50% { transform: scale(1) translateY(-25px) translateX(-3px); opacity: 0.6; }
  100% { transform: scale(0.2) translateY(-45px) translateX(1px); opacity: 0; }
}



/* --- Animations --- */
@keyframes rainbow-pan {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@keyframes glint-pan {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

@keyframes galaxy-move {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes prismatic-shimmer {
  0% {
    background-position: 0% 0%;
  }

  50% {
    background-position: 100% 100%;
  }

  100% {
    background-position: 0% 0%;
  }
}

@keyframes lime-flicker {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 8px #32ff7e;
  }

  50% {
    opacity: 0.8;
    box-shadow: 0 0 15px #32ff7e;
  }
}

@keyframes chrome-shine {
  from { background-position: 0% 0%; }
  to { background-position: 200% 0%; }
}

@keyframes text-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes plasma-swipe {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes inferno-flow {
  to {
    background-position: 0 200%;
  }
}

@keyframes cyberpunk-glitch {

  0%,
  100% {
    box-shadow: 3px 3px 0px #ff003c, -2px -2px 0px #00f3ff;
    transform: skew(0);
  }

  92% {
    box-shadow: 3px 3px 0px #ff003c, -2px -2px 0px #00f3ff;
    transform: skew(0);
  }

  94% {
    box-shadow: 5px 2px 0px #ff003c, -3px -1px 0px #00f3ff;
    transform: skew(2deg);
  }

  96% {
    box-shadow: -3px -2px 0px #ff003c, 2px 3px 0px #00f3ff;
    transform: skew(-3deg);
  }

  98% {
    box-shadow: 2px 4px 0px #ff003c, -4px -2px 0px #00f3ff;
    transform: skew(1deg);
  }
}

@keyframes galaxy-stars {
  0%, 100% { opacity: 0; transform: scale(0.65); }
  50% { opacity: 1; transform: scale(1); }
}

.shimmer-text {
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: rainbow-pan 3s linear infinite !important;
  display: inline-block !important;
}

.fire-pan {
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: rainbow-pan 3s linear infinite !important;
  font-weight: 800 !important;
  display: inline-block !important;
}

@keyframes fire-pan-anim {
  to {
    background-position: 200% center;
  }
}



.plasma_art {
  background: linear-gradient(90deg, #4b0082, #9d50bb, #ff00cc, #9d50bb, #4b0082) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: plasma-swipe 2s linear infinite !important;
  font-weight: 800 !important;
  display: inline-block !important;
  will-change: background-position !important;
  filter: drop-shadow(0 0 2px rgba(157, 80, 187, 0.3)) !important;
}

.golden_record {
  background: linear-gradient(90deg, #bf953f, #fcf6ba, #ffffff, #fcf6ba, #bf953f) !important;
  background-size: 200% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: text-shine 3s linear infinite !important;
  font-weight: 800 !important;
  display: inline-block !important;
  will-change: background-position !important;
}



.pulse-red {
  animation: pulse-red-anim 2s infinite ease-in-out !important;
}

@keyframes pulse-red-anim {

  0%,
  100% {
    text-shadow: 0 0 5px #ff0000, 0 0 10px #ff0000, 0 0 20px #ff0000;
    filter: brightness(1);
  }

  50% {
    text-shadow: 0 0 10px #ff0000, 0 0 20px #ff4d4d, 0 0 40px #ff4d4d;
    filter: brightness(1.5);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes borderGlow {
  from {
    border-image: var(--border-gradient, none) 1;
  }

  to {
    border-image: var(--border-gradient, none) 1;
  }
}

@keyframes auraGlow {
  0% {
    border-image: var(--border-gradient, none) 1;
    box-shadow: 0 0 10px var(--border);
  }

  50% {
    border-image: var(--border-gradient, none) 1;
    box-shadow: 0 0 20px var(--accent);
  }

  100% {
    border-image: var(--border-gradient, none) 1;
    box-shadow: 0 0 10px var(--border);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-alpha);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(94, 176, 249, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(94, 176, 249, 0);
  }
}

@media(max-width:768px) {

  html,
  body {
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100vw
  }

  #app {
    height: auto !important;
    min-height: 100vh;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto !important;
    display: block !important;
  }

  main {
    display: block !important;
    height: auto !important;
    overflow-x: hidden;
    overflow-y: visible;
    max-width: 100vw
  }

  header {
    padding: 10px 12px
  }

  header>div:first-child {
    gap: 6px !important
  }

  header>div:last-child {
    gap: 8px !important
  }

  header h1 {
    font-size: 1.15rem;
    white-space: nowrap
  }

  header .game-num {
    font-size: 0.75rem;
    padding: 2px 6px;
    white-space: nowrap
  }

  #countdown {
    font-size: 0.65rem;
    text-align: center;
    line-height: 1.2
  }

  .lb-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    white-space: nowrap
  }

  #lb-modal {
    max-width: 96%;
    max-height: 90vh
  }

  #lb-modal .lb-header {
    padding: 20px 20px 0
  }

  .lb-tabs {
    width: 100%;
    margin: 0 auto 20px;
  }

  .lb-content {
    padding: 16px 20px 20px
  }

  #left-panel {
    width: 100%;
    min-width: 0;
    max-height: none;
    border-right: none;
    border-bottom: none;
    border-top: 2px solid var(--border);
    border-image: var(--border-gradient, none) 1;
    animation: borderGlow 3s ease-in-out infinite alternate;
    order: 2;
    display: flex;
    flex-direction: column;
    overflow: visible;
    flex: 1;
    background: var(--bg); /* Ensure solid background on mobile to prevent bleed */
  }

  #guess-section {
    border-bottom: 2px solid var(--border);
    border-image: var(--border-gradient, none) 1;
    animation: borderGlow 3s ease-in-out infinite alternate;
  }

  #wiki-panel {
    padding: 16px
  }



  #tree-container {
    flex-shrink: 0 !important;
    order: 1;
    border-bottom: 2px solid var(--border);
    border-image: var(--border-gradient, none) 1;
    animation: borderGlow 3s ease-in-out infinite alternate;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: hidden;
    touch-action: auto !important;
    background-attachment: scroll !important;
  }

  #tree-svg {
    max-width: none;
    max-height: none;
    width: auto;
    height: auto !important;
  }

  #quick-rules, #guess-section, #authorship-credit, #wiki-panel {
    background-attachment: scroll !important;
  }
}

/* Pets System Styles - Global */
.pet-card {
  cursor: pointer;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.pet-card:hover {
  transform: translateY(-5px);
  filter: brightness(1.1);
}
.pet-card.active {
  border-color: var(--accent);
  background: rgba(255,255,255,0.05) !important;
}

#pet-avatar-display:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* Responsive Overrides (Mobile) */
@media (max-width: 768px) {
  .modal {
    padding: 24px 16px !important;
    margin: 10px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
  }

  .modal .close-btn,
  .lb-close,
  .htp-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: auto !important;
    height: auto !important;
    min-width: 36px !important;
    min-height: 28px !important;
    font-size: 13px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    z-index: 100 !important;
  }

  #shop-content {
    max-height: 50vh !important;
  }

  #lb-modal,
  #htp-modal {
    padding: 24px 16px !important;
    margin: 10px auto;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    width: 95% !important;
  }

  .mobile-footer {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg2);
    border-top: 2px solid var(--border);
    padding: 12px 16px;
    z-index: 1000;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
    animation: borderGlow 3s ease-in-out infinite alternate;
  }
}

/* --- Gacha & Pet Enhancements - Global --- */
.gacha-banner:not(.locked):hover .hatchery-egg {
    animation: eggShake 0.6s ease-in-out infinite;
}

.gacha-banner.locked .hatchery-egg {
    filter: grayscale(1) opacity(0.5);
}

@keyframes eggShake {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

.shake-denied {
    animation: shakeDenied 0.4s ease-in-out;
}

@keyframes shakeDenied {
    0%, 100% { transform: translateX(0); color: inherit; }
    20%, 60% { transform: translateX(-8px); color: #ff4d4d; }
    40%, 80% { transform: translateX(8px); color: #ff4d4d; }
}

.pet-card.active {
    animation: rarityGlow 2s ease-in-out infinite alternate;
}

@keyframes rarityGlow {
    from { box-shadow: 0 0 5px rgba(var(--accent-rgb), 0.2); }
    to { box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.5); }
}

.pet-card .equip-btn:hover {
    background: var(--accent);
    color: #000;
}

/* --- Hatch Animation --- */
.hatch-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hatch-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hatch-egg {
    font-size: 8rem;
    cursor: default;
    user-select: none;
    z-index: 10;
}

.shake-violent {
    animation: shakeViolent 0.1s infinite;
}

@keyframes shakeViolent {
    0% { transform: translate(0,0); }
    25% { transform: translate(-5px, 2px) rotate(-3deg); }
    50% { transform: translate(5px, -2px) rotate(3deg); }
    75% { transform: translate(-3px, -3px) rotate(-1deg); }
    100% { transform: translate(3px, 3px) rotate(1deg); }
}

.hatch-light {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0;
    z-index: 5;
}

.hatch-light.burst {
    animation: burstLight 0.8s ease-out forwards;
}

@keyframes burstLight {
    0% { width: 10px; height: 10px; opacity: 1; }
    50% { opacity: 1; }
    100% { width: 800px; height: 800px; opacity: 0; }
}

.hatch-result {
    flex-direction: column;
    align-items: center;
    z-index: 15;
}

.hatch-pet-icon .tw-huge {
    width: 120px !important;
    height: 120px !important;
}

.hatch-rarity {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-top: 20px;
}

.hatch-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: #fff;
    margin-top: 5px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.reveal-pop {
    animation: revealPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes revealPop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
