/* ================================
   BASE
================================ */

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
  color: white;
  overflow-x: hidden;
  overflow-y: auto;
  background: #050505;
}

.hidden {
  display: none;
}

/* Asegurar que elementos clave respeten .hidden aunque haya reglas posteriores */
.top-bar.hidden,
.mobile-menu-overlay.hidden,
.hamburger.hidden,
#mobile-menu-overlay.hidden,
#hamburger-btn.hidden,
#top-bar.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ================================
   FONDOS Y CAPAS DEL DOJO
================================ */

.layer-wood,
.layer-shoji,
.layer-pattern {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
  transition: transform 0.05s ease-out;
  animation: none;
  z-index: -3;
}

.layer-wood {
  background-image: url("/varios/textures/hinoki-dark-e1.png");
  opacity: 0.55;
  filter: brightness(0.85) contrast(1.1);
}

.layer-shoji {
  background:
    radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    repeating-linear-gradient(to right, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 40px),
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.05) 0px, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 40px);
  background-size: 3px 3px, 4px 4px, 40px 40px, 40px 40px;
  mix-blend-mode: soft-light;
  opacity: 0.28;
  z-index: -2.5;
}

.layer-pattern {
  background-image:
    radial-gradient(circle at 0 0, rgba(255,255,255,0.04) 0, transparent 40%),
    radial-gradient(circle at 100% 0, rgba(255,255,255,0.04) 0, transparent 40%),
    radial-gradient(circle at 0 100%, rgba(255,255,255,0.04) 0, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(255,255,255,0.04) 0, transparent 40%);
  mix-blend-mode: overlay;
  opacity: 0.4;
  animation: patternMove 40s linear infinite;
  z-index: -2;
}

@keyframes patternMove {
  from { transform: translateY(0); }
  to { transform: translateY(-80px); }
}

/* ================================
   CONTENEDOR GENERAL
================================ */

.container {
  width: 100%;
  max-width: 480px;
  margin: auto;
  padding-top: 40px;
  position: relative;
  z-index: 10;
}

/* ================================
   LOGIN — ESTILOS SEPARADOS
================================ */

#auth-container {
  background: rgba(0,0,0,0.35);
  padding: 22px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.15);
  width: 100%;
  max-width: 360px;
  margin: 0 auto 25px auto;
  text-align: center;
  box-sizing: border-box;
}

#auth-container input[type="email"],
#auth-container input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}

#auth-container button {
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s ease;
  box-sizing: border-box;
}

#btn-register {
  background: #c0392b;
  color: white;
}

#btn-register:hover {
  background: #e74c3c;
}

#btn-login {
  background: #2980b9;
  color: white;
}

#btn-login:hover {
  background: #3498db;
}

/* ================================
   HEADER (AVATAR + TÍTULO)
================================ */

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.avatar-header {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
}

.title {
  font-size: 34px;
  font-weight: bold;
  color: #f7f3e9;
  text-shadow: 0 0 6px rgba(255, 240, 220, 0.25);
}

.title-cinematic {
  opacity: 0;
  transform: translateY(-12px);
  animation: titleReveal 1.6s ease forwards;
  animation-delay: 1.2s;
}

.subtitle {
  text-align: center;
  margin-bottom: 20px;
  opacity: 0;
  animation: subtitleZen 2.4s ease forwards;
  animation-delay: 2s;
}

/* ================================
   CHAT
================================ */

.chat-box {
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  height: 60vh;
  padding: 15px;
  border-radius: 12px;
  overflow-y: auto;
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 28px rgba(255, 0, 0, 0.28);
  scroll-behavior: smooth;
}

/* Fondo fijo de Yumiko detrás del chat */
#yumiko-bg {
  position: absolute;
  inset: 0;
  background-image: url('/varios/yumiko/yumikochat.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center bottom;
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}

/* Asegura que el chat esté por encima del fondo */
.chat-box {
  position: relative;
  z-index: 1;
}

/* ===============================
   YUMIKO RETURN NUDGES / TOASTS
=============================== */
.yumiko-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(17, 12, 26, 0.92);
  color: #f7f3e9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  padding: 14px 46px 14px 18px;
  max-width: min(560px, calc(100vw - 32px));
  font-size: 0.95rem;
  line-height: 1.4;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.yumiko-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.yumiko-toast--hide {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
}

.yumiko-toast__text {
  white-space: pre-line;
}

.yumiko-toast__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f7f3e9;
  font-size: 18px;
  line-height: 28px;
  cursor: pointer;
}

.yumiko-toast__close:hover {
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 640px) {
  .yumiko-toast {
    bottom: 16px;
    padding: 12px 40px 12px 16px;
    font-size: 0.9rem;
  }
}


/* ================================
   MENSAJES
================================ */

.message {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  animation: fadeIn 0.3s ease;
}

.avatar-small {
  width: 38px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
}

.bubble {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 70%;
  line-height: 1.4;
}

.user .bubble {
  background: #ff4d4d;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.bot .bubble {
  background: rgba(255, 255, 255, 0.14);
  border-left: 3px solid #ff4d4d;
  border-bottom-left-radius: 4px;
}

/* ================================
   INPUT DEL CHAT
================================ */

.input-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

#user-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 16px;
  box-sizing: border-box;
}


#send-btn {
  padding: 12px 20px;
  background: #ff4d4d;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  font-weight: bold;
  transition: 0.2s;
}

#send-btn:hover {
  background: #ff1a1a;
}

/* ================================
   BOTONES EXTRA
================================ */

.extra-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.extra-buttons button {
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.75);
  color: #f7f3e9;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(6px);
}

.extra-buttons button:hover {
  background: rgba(255, 77, 77, 0.85);
  color: white;
  border-color: white;
}

/* ================================
   EFECTOS (GLOW, AURA, PARTÍCULAS)
================================ */

.glow-yumiko,
.particles-anime,
.aura-yumiko {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.glow-yumiko {
  background: radial-gradient(circle at 50% 50%, rgba(255,80,80,0.25), transparent 70%);
  z-index: 8;
}

.particles-anime {
  z-index: 7;
  background-image: radial-gradient(circle, rgba(255,80,80,0.12) 1px, transparent 1px);
  background-size: 4px 4px;
  animation: particlesFloat 60s linear infinite;
}

.aura-yumiko {
  z-index: 6;
  background: radial-gradient(circle at center, rgba(255, 60, 60, 0.18), transparent 70%);
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.6s ease;
}

/* ================================
   TOP BAR (DESKTOP)
================================ */

.top-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 9999;
}

.top-btn {
  padding: 10px 16px;
  background: rgba(255, 80, 80, 0.85);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: 0.2s ease;
}

.top-btn:hover {
  background: rgba(255, 120, 120, 1);
  transform: scale(1.05);
}

/* ================================
   HAMBURGER BUTTON (MOBILE)
================================ */

.hamburger {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 26px;
  display: none;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  z-index: 10001;
}

.hamburger div {
  width: 100%;
  height: 4px;
  background: rgba(255, 80, 80, 0.9);
  border-radius: 4px;
}

/* ================================
   MOBILE MENU OVERLAY
================================ */

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: flex-end;
}

.mobile-menu-drawer {
  width: 260px;
  max-width: 80%;
  background: rgba(0,0,0,0.85);
  border-left: 1px solid rgba(255,255,255,0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.mobile-menu-overlay.active .mobile-menu-drawer {
  transform: translateX(0);
}

.mobile-menu-btn {
  padding: 12px 16px;
  background: rgba(255, 80, 80, 0.85);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s ease;
}

.mobile-menu-btn.logout {
  background: rgba(255, 50, 50, 0.9);
}

.mobile-menu-btn:hover {
  background: rgba(255, 120, 120, 1);
}
.inventory-close-btn {
  padding: 10px 16px;
  background: #ff4d4d;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  align-self: flex-end;
  transition: 0.2s ease;
}

.inventory-close-btn:hover {
  background: #ff1a1a;
}

/* ================================
   RESPONSIVE — MOBILE
================================ */

@media (max-width: 768px) {
  /* Ocultar top bar en mobile */
  .top-bar {
    display: none !important;
  }

  /* Mostrar botón hamburguesa en mobile */
  .hamburger {
    display: flex !important;
  }
}
/* ================================
   INVENTARIO LATERAL — ITEMS
================================ */

.inv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
}

.inv-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
}

.inv-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.inv-nombre {
  font-weight: 600;
  font-size: 15px;
}

.inv-detalle {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 4px;
}

/* Responsive */
@media (max-width: 480px) {
  .inv-img {
    width: 48px;
    height: 48px;
  }

  .inv-nombre {
    font-size: 14px;
  }

  .inv-detalle {
    font-size: 12px;
  }
}


/* ================================
   RESPONSIVE — TABLET
================================ */

@media (max-width: 768px) {

  .container {
    width: 92%;
    padding-top: 20px;
  }

  .title {
    font-size: 1.8rem;
    text-align: center;
  }

  .subtitle {
    font-size: 1rem;
  }

  .avatar-header {
    width: 64px;
    height: 64px;
  }

  .chat-box {
    height: 55vh;
    padding: 10px;
    font-size: 0.95rem;
  }

  .bubble {
    max-width: 85%;
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  .extra-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .extra-buttons button {
    width: 100%;
  }
}

/* ================================
   RESPONSIVE — MÓVILES PEQUEÑOS
================================ */

@media (max-width: 480px) {

  .title {
    font-size: 1.5rem;
  }

  .chat-box {
    height: 50vh;
  }

  .bubble {
    font-size: 0.85rem;
  }

  .avatar-small {
    width: 28px;
    height: 28px;
  }
}


/* ================================
   INVENTARIO — BOTÓN USAR FONDO (solo index)
================================ */
.inv-use-btn{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,77,77,0.85);
  color: white;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
}
.inv-use-btn:hover{
  transform: scale(1.02);
  background: rgba(255,120,120,1);
}
