@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=JetBrains+Mono:wght@500&family=Noto+Sans+JP:wght@400;700&display=swap");

:root {
  --bg: #050505;
  --card-bg: #0d0d0f;
  --card-border: #1a1a1c;
  --accent: #e11d48; /* Crimson Red */
  --accent-glow: rgba(225, 29, 72, 0.3);
  --text: #f0f0f0;
  --text-dim: #71717a;
  --red: #ff3e3e;
  --yellow: #ffb800;
  --gold: #ffd700;
  --green: #10b981;
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
  --chakra-glow: 0 0 20px rgba(225, 29, 72, 0.5);
}

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

html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  font-size: 0.9375rem;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: "JetBrains Mono", monospace;
}
.jp {
  font-family: "Noto Sans JP", sans-serif;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem; /* 24px desktop padding - reducido de 30px */
  padding-bottom: 3rem; /* 48px - reducido de 80px */
}

h1,
h2,
h3 {
  font-weight: 700;
}

/* NAVBAR */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  margin-bottom: 24px;
  position: sticky;
  top: 10px;
  z-index: 100;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  background: #000;
  padding: 5px;
  border-radius: 10px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tab {
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.2s;
  white-space: nowrap;
  border: none;
  background: transparent;
}

.nav-tab:hover {
  color: var(--text);
  background: #1a1a1c;
}

.nav-tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* CARDS */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #18181b;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  transition:
    transform 0.2s,
    border-color 0.2s;
}

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

.stat-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
}

/* TABLES */
.table-wrap,
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar oscuro para tablas */
.table-wrap::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track,
.table-wrapper::-webkit-scrollbar-track {
  background: #0a0a0c;
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

.table-wrap,
.table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: #27272a #0a0a0c;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #0e0e10;
}

th {
  background: #18181b;
  padding: 14px 16px;
  text-align: left;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--card-border);
  color: #ccc;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-red {
  background: rgba(255, 68, 68, 0.1);
  color: var(--red);
}

.badge-green {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
}

.badge-yellow {
  background: rgba(255, 170, 0, 0.1);
  color: var(--yellow);
}

.badge-blue {
  background: rgba(91, 94, 244, 0.1);
  color: var(--accent);
}

.badge-gray {
  background: #252529;
  color: #a1a1aa;
}

.badge-purple {
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

.badge-mute {
  background: #331100;
  color: #ff8800;
}

/* TABS CONTENT */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* BUTTONS */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  background: #252529;
  color: #fff;
  border: 1px solid #333;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm-green {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

/* FORMS */
.input-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: #000;
  border: 1px solid var(--card-border);
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
}

/* Inputs en modales - forzar background oscuro */
.ninja-modal input[type="text"],
.ninja-modal input[type="password"],
.ninja-modal input[type="number"],
.ninja-modal input[type="url"],
.ninja-modal textarea {
  background: #000 !important;
  color: #fff !important;
  border: 1px solid var(--card-border);
}

.ninja-modal input::placeholder,
.ninja-modal textarea::placeholder {
  color: var(--text-dim);
}

/* Modal Forms - Estilos específicos */
.ninja-modal select {
  background: #000;
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}

.ninja-modal select:focus {
  border-color: var(--accent);
}

.ninja-modal select option {
  background: #000;
  color: #fff;
}

/* USER PROFILE SEARCH */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}

.profile-stat {
  text-align: center;
  background: #18181b;
  padding: 10px 15px;
  border-radius: 8px;
  min-width: 80px;
}

.profile-stat .num {
  font-size: 18px;
  font-weight: 800;
}

.profile-stat .lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.profile-stat .num.green {
  color: var(--accent);
}

.profile-stat .num.blue {
  color: var(--accent);
}

/* SETTINGS ITEM & GRID */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  margin-top: 10px;
}

.setting-item {
  background: #09090b;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #1a1a1c;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s;
}

.setting-item:hover {
  border-color: var(--accent);
  background: #0d0d0f;
}

.setting-info {
  margin-bottom: 12px;
}

.setting-label {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
  color: #fff;
}

.setting-key {
  font-family: monospace;
  font-size: 10px;
  color: #444;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.setting-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}

/* TOGGLE SWITCH */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #222;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #555;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #fff;
}

/* LOGIN SCREEN */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* SESSION WARNING */
#session-warning {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #2a1500;
  border: 1px solid #ffaa00;
  padding: 14px 24px;
  border-radius: 12px;
  z-index: 2000;
  display: none; /* JS debe usar display = 'flex' para mostrarlo */
  align-items: center;
  gap: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  min-width: 300px;
  max-width: calc(100vw - 40px);
}

/* SETTINGS LAYOUT (SIDEBAR) */
.settings-layout {
  display: flex;
  background: var(--bg);
  min-height: 500px;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  width: 100%;
}

/* .settings-menu era una clase huérfana — unificada con .settings-sidebar arriba */

.menu-item {
  background: transparent;
  border: none;
  padding: 12px 16px;
  text-align: left;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.menu-item span {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.menu-item:hover {
  background: #151518;
  color: #fff;
}

.menu-item.active {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.settings-pane {
  flex: 1;
  padding: 30px;
  background: var(--bg);
  overflow-y: auto;
}

.pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.pane.active {
  display: block;
}

.pane-header {
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #1a1a1c;
}

.pane-header h2 {
  font-size: 20px;
  margin-bottom: 5px;
}

/* --- RAFFLE & MISSION CARDS v3.0 --- */
.mission-card {
  background: linear-gradient(135deg, #0d0d0f 0%, #050505 100%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.mission-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: 16px;
  background: linear-gradient(90deg, var(--accent), transparent, var(--accent)) border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  opacity: 0.3;
  animation: border-glow 3s infinite;
}

.mission-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.mission-card .badge-type {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 10px;
  padding: 4px 10px;
  background: rgba(225, 29, 72, 0.2);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 800;
  letter-spacing: 1px;
}

.mission-card h3 {
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mission-card .prize-tag {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  color: #fff;
}

.mission-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 15px;
}

.mission-card .progress-bar {
  height: 6px;
  background: #1a1a1c;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.mission-card .progress-fill {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.5s ease-out;
}

.ninja-silks {
  display: flex;
  gap: -8px;
  margin-bottom: 10px;
}

.ninja-silk {
  width: 24px;
  height: 24px;
  background: #252529;
  border: 2px solid #000;
  border-radius: 50%;
  position: relative;
}

/* --- RAFFLE TIMELINE --- */
.raffle-timeline {
  position: relative;
  padding-left: 30px;
  margin-top: 20px;
}

.raffle-timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 25px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
}

.timeline-card {
  background: #0d0d0f;
  border: 1px solid #1a1a1c;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-card .winner {
  color: var(--gold);
  font-weight: 800;
}
/* --- MODALS & FLOATING BTN --- */
.ninja-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none; /* Flex when active */
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(15px);
  padding: 20px;
}

.pergamino-content {
  background: #0d0d0f;
  border: 2px solid var(--accent);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  padding: 30px;
  position: relative;
  box-shadow: 0 0 50px rgba(225, 29, 72, 0.4);
  animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.close-modal:hover {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
}

.floating-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 5px 20px var(--accent-glow);
  cursor: pointer;
  z-index: 500;
  display: none; /* Only mobile (?) */
  transition: transform 0.3s;
}

.floating-btn:hover {
  transform: scale(1.1) rotate(90deg);
}

.mission-preview {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid #1a1a1c;
}

@media (max-width: 768px) {
  .floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0.9375rem;
    padding-bottom: 6.25rem;
  }

  .top-bar {
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.625rem;
    text-align: center;
    position: static;
    border-radius: 0;
    margin: -0.625rem -0.625rem 0.9375rem -0.625rem;
    width: calc(100% + 1.25rem);
  }

  .top-bar div:last-child {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  /* ... other mobile styles ... */
  .nav-tabs {
    display: none !important;
  } /* Hide tabs on mobile for bottom nav */

  .stats-grid {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 15px;
  }

  .settings-layout {
    flex-direction: column;
    border: none;
    background: transparent;
  }
}

@media (max-width: 480px) {
  .stat-value {
    font-size: 22px;
  }

  .btn {
    padding: 10px;
    font-size: 13px;
  }

  .logo-icon {
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.75rem;
  }
}

@keyframes pulse-red {
  0% {
    filter: drop-shadow(0 0 5px var(--accent));
  }
  50% {
    filter: drop-shadow(0 0 15px var(--accent));
  }
  100% {
    filter: drop-shadow(0 0 5px var(--accent));
  }
}

@keyframes float-particles {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) translateX(20px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes chakra-flow {
  0% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(225, 29, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
  }
}

@keyframes border-glow {
  0% {
    border-color: var(--card-border);
  }
  50% {
    border-color: var(--accent);
    shadow: 0 0 10px var(--accent-glow);
  }
  100% {
    border-color: var(--card-border);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* --- LOGIN V3.0 --- */
.ninja-login {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow: hidden;
}

.particles-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  filter: blur(1px);
  animation: float-particles linear infinite;
}

.login-dojo {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
  background: rgba(13, 13, 15, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.ninja-mask {
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  fill: var(--accent);
  animation: pulse-red 3s infinite ease-in-out;
}

.login-dojo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 5px;
  color: #fff;
  text-shadow: 0 0 10px rgba(225, 29, 72, 0.5);
}

.subtitle {
  display: block;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 40px;
  letter-spacing: 1px;
}

.seal-input {
  position: relative;
  margin-bottom: 30px;
  text-align: left;
}

.seal-input input {
  width: 100%;
  background: #000;
  border: 1px solid #1a1a1c;
  padding: 15px 20px;
  border-radius: 12px;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  outline: none;
  transition: all 0.3s;
}

.seal-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(225, 29, 72, 0.2);
}

.chakra-line {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.4s ease;
  transform: translateX(-50%);
}

.seal-input input:focus + .chakra-line {
  width: 100%;
  box-shadow: 0 0 10px var(--accent);
}

.jutsu-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.jutsu-btn:hover {
  transform: scale(1.02);
  background: #ff1f51;
  box-shadow: var(--chakra-glow);
}

.error-shake {
  animation: shake 0.4s ease-in-out;
  border-color: var(--red) !important;
}

.jp-small {
  font-size: 10px;
  display: block;
  margin-top: 5px;
  opacity: 0.6;
}

/* --- RAFFLE & MISSION CARDS v3.0 --- */
.mission-card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.mission-card .badge-type {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 10px;
  padding: 4px 10px;
  background: rgba(225, 29, 72, 0.2);
  color: var(--accent);
  border-radius: 20px;
  font-weight: 800;
  letter-spacing: 1px;
}

.mission-card h3 {
  font-size: 20px;
  color: var(--gold);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mission-card .prize-tag {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
  color: #fff;
}

.mission-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 15px;
}

.mission-card .progress-bar {
  height: 6px;
  background: #1a1a1c;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.mission-card .progress-fill {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.5s ease-out;
}

/* --- RAFFLE TIMELINE --- */
.raffle-timeline {
  position: relative;
  padding-left: 30px;
  margin-top: 20px;
}

.raffle-timeline::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 25px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent);
}

.timeline-card {
  background: #0d0d0f;
  border: 1px solid #1a1a1c;
  border-radius: 12px;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-card .winner {
  color: var(--gold);
  font-weight: 800;
}

/* --- MODALS & FLOATING BTN --- */
.ninja-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(15px);
  padding: 20px;
}

.pergamino-content {
  background: #0d0d0f;
  border: 2px solid var(--accent);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  padding: 30px;
  position: relative;
  box-shadow: 0 0 50px rgba(225, 29, 72, 0.4);
  animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
}

.close-modal:hover {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
}

.floating-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 24px;
  box-shadow: 0 5px 20px var(--accent-glow);
  cursor: pointer;
  z-index: 500;
  display: none;
  transition: transform 0.3s;
}

.floating-btn:hover {
  transform: scale(1.1) rotate(90deg);
}

.mission-preview {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid #1a1a1c;
}

@media (max-width: 768px) {
  .floating-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
/* --- KANBAN BOARD & MISSION NOTES v3.0 --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-col {
  background: rgba(13, 13, 15, 0.5);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  min-height: 500px;
  padding: 15px;
}

.col-header {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 10px;
  margin-bottom: 20px;
  text-align: center;
  border-radius: 8px;
  text-transform: uppercase;
}

.rank-d {
  color: var(--green);
  border: 1px solid var(--green);
  background: rgba(16, 185, 129, 0.1);
}
.rank-c {
  color: var(--yellow);
  border: 1px solid var(--yellow);
  background: rgba(255, 184, 0, 0.1);
}
.rank-s {
  color: var(--red);
  border: 1px solid var(--red);
  background: rgba(255, 62, 62, 0.1);
}

.mission-stack {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.mission-note {
  background: #fdf6e3; /* Paper-like color */
  color: #2c2c2c;
  padding: 15px;
  border-radius: 4px;
  position: relative;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  transform: rotate(-1deg);
  transition: all 0.2s;
  cursor: pointer;
}

.mission-note:nth-child(even) {
  transform: rotate(1deg);
}

.mission-note:hover {
  transform: scale(1.05) rotate(0deg);
  z-index: 10;
  box-shadow: 5px 5px 20px rgba(0, 0, 0, 0.5);
}

.mission-note::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 30px;
  height: 15px;
  background: rgba(225, 29, 72, 0.4);
  transform: translateX(-50%);
  border-radius: 2px;
}

.mission-note h4 {
  margin: 0 0 10px 0;
  font-weight: 800;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
  padding-bottom: 5px;
}

.mission-note p {
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}

.mission-note .seal {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 35px;
  height: 35px;
  opacity: 0.2;
}

.mission-note .status {
  display: block;
  margin-top: 10px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
/* --- SETTINGS V3.0 MASTER SCROLLS --- */
.settings-layout {
  display: flex;
  gap: 30px;
  min-height: 600px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
}

.settings-sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-right: 1px solid var(--card-border);
  padding: 20px;
  background: rgba(13, 13, 15, 0.5);
}

.settings-sidebar .menu-item {
  padding: 12px 20px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text-dim);
  font-weight: 600;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-sidebar .menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.settings-sidebar .menu-item.active {
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
  border-color: rgba(225, 29, 72, 0.2);
}

.settings-pane {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  max-height: 80vh;
}

/* Scrollbar oscuro para settings-pane */
.settings-pane::-webkit-scrollbar {
  width: 8px;
}

.settings-pane::-webkit-scrollbar-track {
  background: #0a0a0c;
  border-radius: 4px;
}

.settings-pane::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}

.settings-pane::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Firefox scrollbar */
.settings-pane {
  scrollbar-width: thin;
  scrollbar-color: #27272a #0a0a0c;
}

.pane {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.pane.active {
  display: block;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  margin-top: 25px;
}

.setting-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.setting-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.setting-item.saving::after {
  content: "GUARDANDO...";
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 5, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent);
  z-index: 10;
  backdrop-filter: blur(4px);
}

.setting-item.saved {
  border-color: var(--green);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.setting-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.info-icon {
  width: 16px;
  height: 16px;
  background: #1a1a1c;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-style: normal;
  cursor: help;
  color: #71717a;
  border: 1px solid #333;
}

.setting-key {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 20px;
  opacity: 0.6;
}

.setting-control {
  margin-top: auto;
}

.input-wrapper {
  position: relative;
}

.save-indicator {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  font-size: 14px;
}

.saved .save-indicator {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  background: #1a1a1c;
  border: 1px solid #333;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-item button {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 0;
  font-size: 14px;
}

/* Movidos desde <style> inline en el <head> */
.setting-input {
  background: #151518;
  border: 1px solid #1a1a1c;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
}

.input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 100px;
}

@media (max-width: 1024px) {
  .settings-layout {
    flex-direction: column;
  }
  .settings-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    padding: 10px;
  }
  .settings-sidebar .menu-item {
    white-space: nowrap;
    padding: 10px 15px;
  }
  .settings-pane {
    padding: 20px;
  }
}
/* ============================================
   MOBILE OPTIMIZADO PARA POVA 6 (6.78")
   Resolución: 1080 x 2460px (~396 ppi)
   ============================================ */

@media (max-width: 768px) {
  /* Contenedor principal - MÁS ESPACIO SUPERIOR */
  .container {
    padding-top: 20px !important; /* 20px espacio superior - AUMENTADO */
    padding-left: 14px !important;
    padding-right: 14px !important;
    padding-bottom: 70px !important; /* Espacio para bottom nav */
  }

  /* MOBILE TOPBAR */
  .mobile-topbar {
    padding: 14px 16px !important;
    margin-bottom: 0 !important;
  }

  /* Espacio después del mobile-topbar */
  .mobile-topbar + #conn-alert {
    margin-top: 16px !important;
  }
  
  /* Espacio para el primer elemento de contenido (tarjetas, stats, etc) */
  .container > .card:first-child,
  .container > .stats-grid:first-child,
  .container > .main-content:first-child,
  .tab-content.active > .card:first-child,
  .tab-content.active > .stats-grid:first-child {
    margin-top: 12px !important; /* 12px espacio superior */
  }
  
  /* Títulos de secciones - más espacio superior */
  .container h2,
  .tab-content h2 {
    margin-top: 16px !important;
    margin-bottom: 12px !important;
  }
  
  /* Primer h2 después del topbar - más espacio */
  .mobile-topbar ~ .container h2:first-of-type,
  .container > h2:first-child,
  .tab-content.active h2:first-child {
    margin-top: 20px !important; /* 20px espacio extra */
  }

  /* TOP BAR - Versión Compacta */
  .top-bar {
    flex-direction: row !important; /* Mantener en fila, no columna */
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px !important; /* Más espacio interno */
    margin-bottom: 0 !important; /* Sin margen, el container ya da espacio */
    border-radius: 0; /* Sin bordes en mobile */
    position: static; /* Quitar sticky */
    width: 100%;
  }

  .top-bar > div:last-child {
    flex-direction: row !important; /* Mantener elementos en fila */
    flex-wrap: wrap;
    gap: 6px !important;
    width: auto;
  }

  /* Logo area más compacta */
  .logo-area {
    gap: 8px;
  }

  .logo-icon {
    width: 28px !important;  /* Reducido de 38px */
    height: 28px !important;
    font-size: 14px;
    border-radius: 8px;
  }

  .mobile-topbar h1 {
    font-size: 15px !important; /* 15px - más compacto */
    font-weight: 700;
  }

  .mobile-topbar #last-update-mobile {
    font-size: 8px !important; /* 8px - más pequeño */
  }

  .top-bar h1 {
    font-size: 15px !important; /* 15px - más compacto */
  }

  #last-update {
    font-size: 8px !important; /* 8px - más pequeño */
  }

  /* Selector de grupo más compacto */
  #group-selector {
    height: 28px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  /* Botón cerrar sesión más pequeño */
  .top-bar .btn-sm {
    padding: 4px 8px !important;
    font-size: 10px !important;
    height: 28px;
  }

  /* Ocultar tabs de navegación desktop */
  .nav-tabs {
    display: none !important;
  }

  /* Stats grid más compacto */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important; /* 2 columnas en lugar de auto-fit */
    gap: 0.625rem !important; /* 10px - más compacto */
    margin-bottom: 0.875rem !important; /* 14px */
  }

  .stat-card {
    padding: 10px !important; /* 10px - más compacto */
  }

  .stat-value {
    font-size: 18px !important; /* 18px - más pequeño */
  }

  .stat-label {
    font-size: 9px !important; /* 9px - más pequeño */
  }

  /* Cards más compactas */
  .card {
    padding: 10px !important; /* 10px - más compacto */
    margin-bottom: 14px; /* 14px */
    border-radius: 12px;
  }

  .card-header {
    margin-bottom: 10px; /* 10px */
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-header h2 {
    font-size: 13px !important; /* 13px - más pequeño */
  }
  
  .card-header .refresh,
  .card-header .btn-sm {
    font-size: 9px !important;
    padding: 4px 8px !important;
  }

  /* Tablas scrollables */
  .table-wrap {
    font-size: 11px; /* 11px - más pequeño */
  }

  th, td {
    padding: 8px 10px !important; /* 8px 10px - más compacto */
    font-size: 11px !important;
  }
  
  /* Títulos más compactos */
  h2 {
    font-size: 16px !important; /* 16px - más pequeño */
    margin-bottom: 12px !important;
  }
  
  h3 {
    font-size: 14px !important; /* 14px - más pequeño */
    margin-bottom: 10px !important;
  }
  
  /* Botones más compactos */
  .btn {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  
  .btn-sm {
    padding: 4px 8px !important;
    font-size: 9px !important;
  }
  
  .btn-sm-green {
    padding: 4px 8px !important;
    font-size: 9px !important;
  }

  /* Kanban board en columna */
  .kanban-board {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .kanban-col {
    min-height: auto;
    padding: 12px;
  }

  /* Settings layout en columna */
  .settings-layout {
    flex-direction: column;
    border: none;
    background: transparent;
    border-radius: 12px;
  }

  .settings-sidebar {
    width: 100% !important;
    flex-direction: row !important;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    padding: 10px;
    gap: 6px;
  }

  .settings-sidebar .menu-item {
    white-space: nowrap;
    padding: 8px 12px !important;
    font-size: 12px;
  }

  .settings-pane {
    padding: 16px;
    max-height: none;
  }

  /* Settings grid */
  .settings-grid {
    grid-template-columns: 1fr !important; /* Una columna en mobile */
    gap: 12px;
  }

  .setting-item {
    padding: 14px;
  }

  /* BOTTOM NAV - Versión Compacta y Optimizada */
  .bottom-nav {
    display: flex !important;
    height: 60px; /* Altura fija compacta */
    padding: 6px 8px;
    gap: 4px;
  }

  .bottom-nav-item {
    font-size: 9px; /* Texto pequeño pero legible */
    gap: 2px;
    flex: 1;
    min-width: 0; /* Permite que se encojan */
    padding: 4px 2px;
  }

  .bottom-nav-item i {
    font-size: 18px; /* Iconos proporcionales */
    line-height: 1;
  }

  .bottom-nav-item.active i {
    transform: translateY(-2px);
  }

  /* Modal más compacto */
  .pergamino-content {
    padding: 20px;
    margin: 10px;
    max-width: calc(100vw - 20px);
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header h2 {
    font-size: 16px;
  }
  
  /* Modal forms en mobile */
  .ninja-modal .input-group {
    margin-bottom: 16px;
  }
  
  .ninja-modal input[type="text"],
  .ninja-modal input[type="number"],
  .ninja-modal input[type="url"],
  .ninja-modal select {
    padding: 10px 12px;
    font-size: 14px; /* Prevenir zoom en iOS */
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
  }

  /* Inputs más compactos */
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select,
  textarea {
    padding: 10px 12px !important;
    font-size: 14px; /* Prevenir zoom en iOS */
  }

  .btn {
    padding: 10px 16px !important;
    font-size: 13px;
  }

  .btn-sm {
    padding: 5px 10px !important;
    font-size: 10px !important;
  }

  /* Footer más compacto - MENOS ESPACIO ABAJO */
  footer {
    font-size: 11px !important;
    margin-top: 8px !important; /* 8px - MUY REDUCIDO */
    padding-top: 8px !important; /* 8px - MUY REDUCIDO */
    padding-bottom: 70px !important; /* Espacio para bottom nav */
  }
}

/* ============================================
   AJUSTES ESPECÍFICOS PARA PANTALLAS ALTAS
   Como Pova 6 (6.78") — viewport lógico ~900px alto
   (La resolución física 2460px / DPR ~2.75 ≈ 894px CSS)
   ============================================ */

@media (max-width: 768px) and (min-height: 800px) {
  /* Pantallas muy altas como Pova 6 */
  .container {
    padding-bottom: 75px !important;
  }

  .bottom-nav {
    height: 65px;
    padding: 8px 12px;
  }

  .bottom-nav-item {
    font-size: 10px;
    gap: 3px;
  }

  .bottom-nav-item i {
    font-size: 20px;
  }
}

/* ============================================
   BOTTOM NAV: visible solo en mobile y solo en dashboard
   ============================================ */

/* Ocultar bottom nav por defecto en desktop */
.bottom-nav {
  display: none !important;
}

/* Mostrar en mobile */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
  }

  /* Ocultar cuando el dashboard no está visible */
  #dashboard[style*="display: none"] + .bottom-nav {
    display: none !important;
  }
}

/* --- LEADERBOARD & ROW STYLES --- */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.leaderboard-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

.leaderboard-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-score {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  color: var(--accent);
  font-size: 14px;
}

/* Activity Table - Expandable Rows */
.user-row {
  cursor: pointer;
  transition: all 0.2s;
}

.user-row:hover {
  background: rgba(225, 29, 72, 0.05);
}

.detail-row {
  display: none;
  background: #0a0a0c;
}

.detail-row.open {
  display: table-row;
}

.detail-inner {
  padding: 15px 20px;
}

.detail-inner table {
  font-size: 12px;
}

.detail-inner th {
  font-size: 10px;
  padding: 8px 12px;
}

.detail-inner td {
  padding: 8px 12px;
  color: var(--text-dim);
}

/* Arrow indicator for expandable rows */
.user-row td:first-child::before {
  content: '›';
  display: inline-block;
  margin-right: 8px;
  font-size: 16px;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.user-row.open td:first-child::before {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Ocultar navegación móvil por defecto (PC) */
.bottom-nav {
  display: none !important;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
  }
}

/* --- SKELETON SCREENS v3.0 --- */
.skeleton {
  background: linear-gradient(90deg, #121214 25%, #1a1a1c 50%, #121214 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s infinite;
  border-radius: 8px;
}

@keyframes skeletonPulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================
   HAMBURGER MENU — Mobile only
   ============================================ */

/* Mobile topbar: oculto en desktop */
.mobile-topbar {
  display: none;
}

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

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px; /* Aumentado de 12px a 14px para más aire */
    background: var(--card-bg);
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 90;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); /* Sombra suave */
  }
}

/* Botón hamburguesa (solo mobile) */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 16px; /* Aumentado de 14px para más aire */
  right: 16px;
  z-index: 200;
  width: 42px;
  height: 42px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hamburger-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background: var(--accent);
}
.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  background: var(--accent);
}

@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }
  .hamburger-btn.hidden {
    display: none !important;
  }
}

/* Overlay oscuro */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 150;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.mobile-menu-overlay.open {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Panel lateral */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(300px, 85vw);
  background: #0a0a0c;
  border-left: 1px solid var(--card-border);
  z-index: 160;
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.8);
  overflow-y: auto;
}

.mobile-menu.open {
  transform: translateX(0);
}

/* Cabecera del menú */
.mobile-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--card-border);
}

.mobile-menu-header span {
  flex: 1;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text);
}

.mobile-menu-close {
  background: none;
  border: 1px solid #333;
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mobile-menu-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Selector de grupo */
.mobile-menu-group-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(255,255,255,0.02);
}

/* Items del menú */
.mobile-menu-items {
  flex: 1;
  padding: 8px 0;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}

.mobile-menu-item:hover {
  background: rgba(255,255,255,0.04);
}

.mobile-menu-item.active {
  background: rgba(225, 29, 72, 0.08);
  border-left-color: var(--accent);
}

.mobile-menu-item.active .mm-label {
  color: #fff;
  font-weight: 700;
}

.mm-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.mm-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
  transition: color 0.15s;
}

.mm-arrow {
  color: #333;
  font-size: 18px;
  font-weight: 300;
  transition: color 0.15s;
}

.mobile-menu-item:hover .mm-arrow,
.mobile-menu-item.active .mm-arrow {
  color: var(--accent);
}

/* Footer del menú */
.mobile-menu-footer {
  padding: 16px;
  border-top: 1px solid var(--card-border);
  background: rgba(0,0,0,0.3);
}

/* Ajuste padding container en mobile para el topbar */
@media (max-width: 768px) {
  .container {
    padding-top: 0.75rem !important; /* 12px espacio superior */
    padding-bottom: 2rem !important;
  }

  /* Espacio después del mobile-topbar */
  .mobile-topbar ~ #conn-alert {
    margin-top: 0.75rem !important;
  }
  
  .mobile-topbar ~ .container > .card:first-child,
  .mobile-topbar ~ .container > .stats-grid:first-child {
    margin-top: 0.5rem !important;
  }

  /* Espacio extra entre mobile-topbar y el contenido */
  .container > h2:first-of-type,
  .container > div:first-child {
    margin-top: 0.5rem;
  }
  
  .nav-tabs {
    display: none !important;
  }
}
