/* =========================================================
   PROFILE MODAL — Perfil de usuario (progreso, tokens, slots)
   Se carga en TODOS los subdominios
   ========================================================= */

/* ===== Profile Tabs (glass style) ===== */
.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.75);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.tab-btn:hover {
  background: rgba(0,255,213,.08);
  border-color: rgba(0,255,213,.25);
  color: rgba(255,255,255,.92);
}

.tab-btn:active {
  transform: translateY(1px);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: transparent;
  color: #08101a;
  box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset;
}

html.light .tab-btn {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.10);
  color: rgba(8,16,26,.70);
}

html.light .tab-btn:hover {
  background: rgba(13,185,166,.10);
  border-color: rgba(13,185,166,.25);
  color: rgba(8,16,26,.92);
}

html.light .tab-btn.active {
  background: linear-gradient(135deg, #00a28a, #0078c8);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255,255,255,.50) inset;
}

.tab-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.profile-card { padding: 0; }

.profile-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  min-height: 560px;
  overflow: hidden;
}

.profile-left {
  padding: 16px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-right {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.profile-right::-webkit-scrollbar { display: none; }

@media (max-width: 820px) { .profile-grid { grid-template-columns: 180px 1fr; } }
@media (max-width: 520px) { .profile-grid { grid-template-columns: 160px 1fr; } }

.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar.empty { background: rgba(255, 255, 255, .04); }
.profile-avatar.empty::after { content: "🏅"; font-size: 24px; opacity: .55; }
.profile-avatar.empty img { display: none; }

.profile-level .lvl { font-weight: 1000; font-size: 20px; letter-spacing: -.4px; line-height: 1.1; }
.profile-level .rank { margin-top: 4px; font-weight: 900; opacity: .92; color: var(--primary); text-shadow: 0 0 16px rgba(0,255,213,.18); }
.profile-addr { font-family: var(--mono); font-size: 12px; opacity: .85; word-break: break-word; }

.profile-bars-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 2px;
}

.profile-slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 4px; }
.slot { border-radius: 16px; border: 1px solid var(--border); background: rgba(255,255,255,.04); padding: 10px; }
.slot-k { font-size: 11px; opacity: .8; font-weight: 900; }
.slot-v { margin-top: 6px; font-size: 12px; font-weight: 900; }

.profile-tabs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }

.profile-fixed {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .03);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.barbox .bar-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar-track { width: 100%; height: 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(255,255,255,.03); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; }
.bar-fill.dharma { background: linear-gradient(90deg, #00A3FF, #00FFD5); box-shadow: 0 0 18px rgba(0,163,255,.22); }
.bar-fill.karma { background: linear-gradient(90deg, #FF2D55, #FF6A00); box-shadow: 0 0 18px rgba(255,45,85,.20); }

.pf-balances { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.profile-content { border-radius: 18px; border: 1px solid var(--border); background: rgba(255,255,255,.02); padding: 12px; min-height: 200px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: none; -ms-overflow-style: none; }
.profile-content::-webkit-scrollbar { display: none; }

/* 🎯 Token cards — glass con acento de color como background sutil */
.token {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .2s;
}
.token:hover {
  transform: translateY(-1px);
}
.token .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .7;
  font-weight: 600;
}
.token .val {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* Dharma — verde esmeralda */
.token-dharma {
  color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,.15), rgba(46,204,113,.04));
  border-color: rgba(46,204,113,.25);
  box-shadow: 0 0 12px rgba(46,204,113,.06);
}
html.light .token-dharma {
  background: linear-gradient(135deg, rgba(46,204,113,.10), rgba(46,204,113,.02));
}

/* Aura — celeste */
.token-aura {
  color: #6EC8FF;
  background: linear-gradient(135deg, rgba(110,200,255,.15), rgba(110,200,255,.04));
  border-color: rgba(110,200,255,.2);
  box-shadow: 0 0 12px rgba(110,200,255,.06);
}
html.light .token-aura {
  background: linear-gradient(135deg, rgba(110,200,255,.10), rgba(110,200,255,.02));
}

/* Token morado "Por Reclamar" (6to token, como los otros 5) */
.token-aura-reclaim {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #a855f7;
  background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(168,85,247,.04));
  border: 1px solid rgba(168,85,247,.25);
  box-shadow: 0 0 12px rgba(168,85,247,.06);
}
html.light .token-aura-reclaim {
  background: linear-gradient(135deg, rgba(168,85,247,.10), rgba(168,85,247,.02));
}
.token-aura-reclaim .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .7;
  font-weight: 600;
}
.token-aura-reclaim .val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: #a855f7;
  font-weight: 900;
}

/* Karma — rojo/rosa */
.token-karma {
  color: #ff6b6b;
  background: linear-gradient(135deg, rgba(255,107,107,.12), rgba(255,107,107,.03));
  border-color: rgba(255,107,107,.2);
  box-shadow: 0 0 12px rgba(255,107,107,.05);
}
.token-karma.negative {
  color: #FF2D55;
  background: linear-gradient(135deg, rgba(255,45,85,.18), rgba(255,45,85,.05));
  border-color: rgba(255,45,85,.3);
}
html.light .token-karma {
  background: linear-gradient(135deg, rgba(255,107,107,.08), rgba(255,107,107,.02));
}

/* $ALEM — dorado */
.token-alem {
  color: #FFD84D;
  background: linear-gradient(135deg, rgba(255,216,77,.15), rgba(255,216,77,.04));
  border-color: rgba(255,216,77,.2);
  box-shadow: 0 0 12px rgba(255,216,77,.06);
}
html.light .token-alem {
  background: linear-gradient(135deg, rgba(255,216,77,.12), rgba(255,216,77,.03));
}

/* veALEM — naranja */
.token-vealem {
  color: #ff9f43;
  background: linear-gradient(135deg, rgba(255,159,67,.15), rgba(255,159,67,.04));
  border-color: rgba(255,159,67,.2);
  box-shadow: 0 0 12px rgba(255,159,67,.06);
}
html.light .token-vealem {
  background: linear-gradient(135deg, rgba(255,159,67,.10), rgba(255,159,67,.02));
}

/* Token morado "Por Reclamar" (6to token, como los otros 5) */
.token-aura-reclaim {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #a855f7;
  background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(168,85,247,.04));
  border: 1px solid rgba(168,85,247,.25);
  box-shadow: 0 0 12px rgba(168,85,247,.06);
}
html.light .token-aura-reclaim {
  background: linear-gradient(135deg, rgba(168,85,247,.10), rgba(168,85,247,.02));
}
.token-aura-reclaim .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .7;
  font-weight: 600;
}
.token-aura-reclaim .val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: #a855f7;
  font-weight: 900;
}

/* ===== Mobile: scroll horizontal en profile-fixed ===== */
@media (max-width: 480px) {
  .pf-balances { display: flex; gap: 8px; min-width: 220px; }
  .profile-fixed > * { flex: 0 0 auto; min-width: 220px; scroll-snap-align: start; }
  .profile-fixed::-webkit-scrollbar { display: none; }
  .profile-fixed { scrollbar-width: none; }
}

/* Dharma — verde esmeralda */
.token-dharma {
  color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,.15), rgba(46,204,113,.04));
  border-color: rgba(46,204,113,.25);
  box-shadow: 0 0 12px rgba(46,204,113,.06);
}
html.light .token-dharma {
  background: linear-gradient(135deg, rgba(46,204,113,.10), rgba(46,204,113,.02));
}

/* Aura — celeste */
.token-aura {
  color: #6EC8FF;
  background: linear-gradient(135deg, rgba(110,200,255,.15), rgba(110,200,255,.04));
  border-color: rgba(110,200,255,.2);
  box-shadow: 0 0 12px rgba(110,200,255,.06);
}
html.light .token-aura {
  background: linear-gradient(135deg, rgba(110,200,255,.10), rgba(110,200,255,.02));
}

/* Token morado "Por Reclamar" (6to token, como los otros 5) */
.token-aura-reclaim {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: #a855f7;
  background: linear-gradient(135deg, rgba(168,85,247,.15), rgba(168,85,247,.04));
  border: 1px solid rgba(168,85,247,.25);
  box-shadow: 0 0 12px rgba(168,85,247,.06);
}
html.light .token-aura-reclaim {
  background: linear-gradient(135deg, rgba(168,85,247,.10), rgba(168,85,247,.02));
}
.token-aura-reclaim .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .7;
  font-weight: 600;
}
.token-aura-reclaim .val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: #a855f7;
  font-weight: 900;
}

/* ===== Estadísticas glass (Estado + Actividad) ===== */
.pf-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pf-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  text-align: center;
}
.pf-stat-label {
  font-size: 10px;
  font-weight: 600;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.2;
}
.pf-stat-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
html.light .pf-stat-item {
  background: rgba(0,0,0,.03);
}

/* Dharma/Aura con color sobre pf-stat-item */
.pf-stat-item.dharma {
  color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,.12), rgba(46,204,113,.03));
  border-color: rgba(46,204,113,.2);
}
.pf-stat-item.aura {
  color: #6EC8FF;
  background: linear-gradient(135deg, rgba(110,200,255,.12), rgba(110,200,255,.03));
  border-color: rgba(110,200,255,.2);
}
html.light .pf-stat-item.dharma {
  background: linear-gradient(135deg, rgba(46,204,113,.10), rgba(46,204,113,.02));
}
html.light .pf-stat-item.aura {
  background: linear-gradient(135deg, rgba(110,200,255,.10), rgba(110,200,255,.02));
}

/* =========================================================
   🛒 MARKETPLACE P2P (Tienda)
========================================================= */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* ===== Mobile: evitar desborde en tabs de estado ===== */
@media (max-width: 520px) {
  .profile-right { min-width: 0; overflow-x: hidden; }
  .profile-content { min-width: 0; overflow-x: hidden; width: 100%; box-sizing: border-box; }
  .profile-content .pf-box { width: 100%; box-sizing: border-box; overflow-x: hidden; word-wrap: break-word; }
  .profile-content .post-tags { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; box-sizing: border-box; }
  .profile-content .post-tags .pill { flex: 1 1 auto; min-width: 0; max-width: 100%; white-space: normal; word-break: break-word; box-sizing: border-box; text-align: left; }
  .profile-content .h2 { font-size: 16px; }
  .profile-content .muted { font-size: 12px; }
  .pf-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Estadísticas glass (Estado + Actividad) ===== */
.pf-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pf-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  text-align: center;
}
.pf-stat-label {
  font-size: 10px;
  font-weight: 600;
  opacity: .7;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.2;
}
.pf-stat-value {
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
html.light .pf-stat-item {
  background: rgba(0,0,0,.03);
}

/* Dharma/Aura con color sobre pf-stat-item */
.pf-stat-item.dharma {
  color: #2ecc71;
  background: linear-gradient(135deg, rgba(46,204,113,.12), rgba(46,204,113,.03));
  border-color: rgba(46,204,113,.2);
}
.pf-stat-item.aura {
  color: #6EC8FF;
  background: linear-gradient(135deg, rgba(110,200,255,.12), rgba(110,200,255,.03));
  border-color: rgba(110,200,255,.2);
}
html.light .pf-stat-item.dharma {
  background: linear-gradient(135deg, rgba(46,204,113,.10), rgba(46,204,113,.02));
}
html.light .pf-stat-item.aura {
  background: linear-gradient(135deg, rgba(110,200,255,.10), rgba(110,200,255,.02));
}


.mk-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  overflow: hidden;
  transition: transform .15s;}
.mk-card:hover { transform: translateY(-2px); }
.mk-card.mk-sold { opacity: .5; }
.mk-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mk-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.mk-img-fallback { font-size: 32px; opacity: .4; }
.mk-info { padding: 8px 10px 10px; }
.mk-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-seller { font-size: 11px; opacity: .6; margin-top: 2px; }
.mk-price { font-size: 13px; font-weight: 700; margin-top: 4px; color: #6EC8FF; }
.mk-status { font-size: 11px; margin-top: 2px; }
.mk-buy-btn {
  margin-top: 6px;
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.mk-buy-btn:hover { opacity: .85; }
.mk-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mk-label {
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
  margin-bottom: -4px;
}
.mk-input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
}
.mk-input.mono { font-family: var(--mono); font-size: 12px; }
.mk-submit {
  margin-top: 6px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6EC8FF, #00A3FF);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.mk-submit:hover { opacity: .85; }
html.light .mk-card { background: rgba(0,0,0,.02); }
html.light .mk-input { background: rgba(0,0,0,.03); }

/* ===== FARM TAB — Mini-game diario pixel art ===== */
.farm-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.farm-streak {
  background: rgba(255,215,0,.12);
  color: #ffd700;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
}
html.light .farm-streak {
  background: rgba(180,150,0,.10);
  color: #8a7500;
}

.farm-overlay {
  animation: fadeInOverlay 0.3s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.farm-overlay .tab-btn {
  background: linear-gradient(135deg, var(--primary, #00ffd5), var(--accent, #0088ff));
  border: none;
  color: #08101a;
  font-weight: 700;
}
.farm-overlay .tab-btn:hover {
  opacity: .85;
}

#farmCanvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.farm-history {
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
}
html.light .farm-history {
  background: rgba(0,0,0,.02);
  border-color: rgba(0,0,0,.08);
}
.mk-card:hover { transform: translateY(-2px); }
.mk-card.mk-sold { opacity: .5; }
.mk-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255,255,255,.04);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mk-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.mk-img-fallback { font-size: 32px; opacity: .4; }
.mk-info { padding: 8px 10px 10px; }
.mk-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-seller { font-size: 11px; opacity: .6; margin-top: 2px; }
.mk-price { font-size: 13px; font-weight: 700; margin-top: 4px; color: #6EC8FF; }
.mk-status { font-size: 11px; margin-top: 2px; }
.mk-buy-btn {
  margin-top: 6px;
  width: 100%;
  padding: 6px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}
.mk-buy-btn:hover { opacity: .85; }
.mk-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mk-label {
  font-size: 11px;
  font-weight: 700;
  opacity: .7;
  margin-bottom: -4px;
}
.mk-input {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
}
.mk-input.mono { font-family: var(--mono); font-size: 12px; }
.mk-submit {
  margin-top: 6px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #6EC8FF, #00A3FF);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.mk-submit:hover { opacity: .85; }
html.light .mk-card { background: rgba(0,0,0,.02); }
html.light .mk-input { background: rgba(0,0,0,.03); }
