/* Lynk Adventure Game CSS */
.la-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: #1a0a2e;
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

/* Navbar spacer */
.la-navbar-spacer {
  height: max(var(--lynk-header-h, 5rem), calc(env(safe-area-inset-top, 0px) + 4.5rem));
  flex-shrink: 0;
}

/* HUD */
#la-hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(0,0,0,0.7);
  flex-wrap: wrap;
  position: relative;
  z-index: 10;
  min-height: 44px;
}
.la-bar-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
}
.la-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.la-bar-bg {
  background: #2a1a3e;
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.la-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.35s ease;
}
.la-hp-fill  { background: linear-gradient(90deg, #ff4d6d, #ff8fa3); }
.la-mp-fill  { background: linear-gradient(90deg, #4361ee, #7209b7); }
.la-exp-fill { background: linear-gradient(90deg, #ffd60a, #fb8500); }
.la-hp-txt, .la-lv-txt {
  font-size: 0.72rem;
  color: #fff;
}
.la-lv-txt { color: #ffd60a; font-weight: 700; }
.la-notes-hud {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #ffd60a;
  font-weight: 700;
  font-size: 0.9rem;
  margin-left: auto;
}
.la-shop-open-btn {
  background: linear-gradient(135deg, #f8961e, #f3722c);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 4px 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  transition: filter 0.2s;
}
.la-shop-open-btn:hover { filter: brightness(1.15); }

/* Map */
#la-map-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #2d1b4e;
  cursor: none;
}
#la-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  image-rendering: -webkit-optimize-contrast;
}
#la-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.la-note-particle {
  position: absolute;
  color: #ffd60a;
  font-size: 1.1rem;
  opacity: 1;
  animation: la-float 3s ease-out forwards;
  pointer-events: none;
}
@keyframes la-float {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-70px) scale(0.7); }
}

/* D-Pad */
#la-dpad {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: none;
  z-index: 20;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 3px;
}
@media (pointer: coarse) {
  #la-dpad { display: grid; }
}
.la-dpad-btn {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
}
.la-dpad-btn:active { background: rgba(199,125,255,0.4); }

/* Overlays */
#la-combat,
#la-shop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
#la-combat[hidden], #la-shop[hidden] { display: none; }

/* Combat Box */
.la-combat-box {
  background: #1e0a3c;
  border: 2px solid #c77dff;
  border-radius: 16px;
  padding: 20px;
  width: min(500px, 94%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  position: relative;
}
.la-combatant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
}
.la-combatant img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}
.la-combatant-name { color: #e0aaff; font-size: 0.82rem; font-weight: 700; }
.la-combatant-hp   { color: #fff; font-size: 0.72rem; }
.la-vs-label {
  grid-column: span 2;
  text-align: center;
  color: #ffd60a;
  font-size: 1.3rem;
  font-weight: 900;
  margin: -4px 0;
}
.la-combat-log {
  grid-column: span 2;
  max-height: 76px;
  overflow-y: auto;
  font-size: 0.78rem;
  color: #ccc;
  padding: 7px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  line-height: 1.5;
}
.la-actions {
  grid-column: span 2;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Buttons */
.la-btn {
  background: linear-gradient(135deg, #c77dff, #e040fb);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: filter 0.18s, transform 0.18s;
  min-width: 90px;
}
.la-btn:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-1px); }
.la-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.la-btn.secondary { background: linear-gradient(135deg, #4361ee, #3a0ca3); }
.la-btn.danger    { background: linear-gradient(135deg, #ef233c, #d90429); }
.la-btn.gold      { background: linear-gradient(135deg, #ffd60a, #fb8500); color: #1a0a2e; }

/* Shop Box */
.la-shop-box {
  background: #1e0a3c;
  border: 2px solid #ffd60a;
  border-radius: 16px;
  padding: 24px;
  width: min(380px, 94%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.la-shop-box h3 {
  margin: 0;
  color: #ffd60a;
  text-align: center;
  font-size: 1.1rem;
}
.la-shop-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.la-pet-card {
  background: rgba(199,125,255,0.12);
  border: 1px solid #c77dff;
  border-radius: 10px;
  padding: 10px 14px;
  color: #e0aaff;
  font-size: 0.85rem;
  line-height: 1.6;
}
.la-pet-card small { color: #aaa; font-size: 0.75rem; }
.la-no-pet { color: #888; font-size: 0.82rem; }

/* Toast message */
#la-message {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 8px 22px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 60;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  white-space: normal;
}
#la-message.show { opacity: 1; }

/* Login prompt */
.la-login-prompt {
  padding: 48px 24px;
  text-align: center;
  color: #e0aaff;
}
.la-login-prompt p { font-size: 1.1rem; margin-bottom: 16px; }
.la-login-prompt a {
  background: linear-gradient(135deg, #c77dff, #e040fb);
  color: #fff;
  padding: 10px 28px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  display: inline-block;
}

/* Mobile */
@media (max-width: 480px) {
  .la-combat-box { grid-template-columns: 1fr; padding: 14px; }
  .la-vs-label, .la-combat-log, .la-actions { grid-column: span 1; }
  .la-combatant img { width: 64px; height: 64px; }
  #la-hud { gap: 7px; padding: 6px 10px; }
  .la-bar-bg { width: 55px !important; }
}
