/**
 * Duskara Fase 4 — Alma do mundo: atmosfera, feedback, UI viva, chat, BP, talentos
 */

/* —— Overlay atmosférico global —— */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--dsk-atmo-tint, transparent);
  opacity: calc(0.35 + var(--dsk-atmo-fog, 0.3) * 0.5);
  mix-blend-mode: screen;
  transition: background 2s ease, opacity 2s ease;
}

body {
  filter: brightness(var(--dsk-atmo-brightness, 1));
  transition: filter 2.5s ease;
}

.dsk-time-night #dsk-ambient-canvas {
  opacity: calc(0.5 + var(--dsk-atmo-glow, 0.5) * 0.35) !important;
}

.dsk-time-dawn {
  --dsk-atmo-tint: rgba(212, 175, 55, 0.14);
}

/* —— UI respira —— */
.house-modal-sheet,
.auth-card,
.inv-hub-col,
.adf-card,
.admin-workspace,
.battle-pass-modal-sheet,
.talent-tree-modal-sheet,
.exploration-modal-sheet {
  position: relative;
  overflow: hidden;
}

.house-modal-sheet::before,
.auth-card::before,
.adf-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(139, 92, 246, 0.04) 50%,
    transparent 60%
  );
  animation: dsk-ui-shimmer 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.house-modal-sheet > *,
.auth-card > * {
  position: relative;
  z-index: 1;
}

@keyframes dsk-ui-shimmer {
  0%, 100% { transform: translateX(-30%); opacity: 0.3; }
  50% { transform: translateX(30%); opacity: 0.7; }
}

.adf-card,
.inv-hub-col {
  animation: dsk-breathe-glow 4s ease-in-out infinite;
}

@keyframes dsk-breathe-glow {
  0%, 100% { box-shadow: var(--dsk-depth-2); }
  50% { box-shadow: var(--dsk-depth-3), 0 0 20px rgba(139, 92, 246, 0.12); }
}

/* Runas decorativas */
.dsk-rune-deco::after {
  content: 'ᚠ';
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 0.65rem;
  opacity: 0.12;
  color: var(--gold-title, #d4af37);
  animation: dsk-rune-fade 6s ease-in-out infinite;
}

@keyframes dsk-rune-fade {
  0%, 100% { opacity: 0.05; }
  50% { opacity: 0.2; }
}

/* —— Texto premium —— */
.dsk-text-legend {
  background: linear-gradient(90deg, #e8d5a3, #d4af37, #f5e6b8, #d4af37);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: dsk-text-shine 4s linear infinite;
  text-shadow: none;
}

.dsk-text-gold {
  color: #d4af37;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

.dsk-text-arcane {
  color: #c084fc;
  text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

@keyframes dsk-text-shine {
  to { background-position: 200% center; }
}

/* —— Feedback overlays —— */
#dsk-feedback-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.dsk-feedback-card {
  pointer-events: none;
  text-align: center;
  padding: 1rem 1.5rem;
  min-width: 240px;
  max-width: 90vw;
  background: rgba(13, 13, 18, 0.92);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.35), 0 20px 50px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(20px) scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  position: relative;
  overflow: visible;
}

.dsk-feedback-card--in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dsk-feedback-card--out {
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
}

.dsk-feedback-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
}

.dsk-feedback-sub {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dsk-loot-flare {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  opacity: 0.6;
  animation: dsk-flare-pulse 1.2s ease-out infinite;
}

.dsk-loot--legendary .dsk-loot-flare,
.dsk-loot--mythical .dsk-loot-flare {
  background: radial-gradient(circle, rgba(212, 175, 55, 0.5), transparent 70%);
}

.dsk-loot--epic .dsk-loot-flare {
  background: radial-gradient(circle, rgba(192, 132, 252, 0.45), transparent 70%);
}

.dsk-feedback-loot--big {
  transform: scale(1.08);
  border-color: rgba(212, 175, 55, 0.7) !important;
  animation: dsk-loot-shake 0.5s ease;
}

@keyframes dsk-flare-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.4; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes dsk-loot-shake {
  0%, 100% { transform: scale(1.05) rotate(0); }
  25% { transform: scale(1.08) rotate(-1deg); }
  75% { transform: scale(1.08) rotate(1deg); }
}

.dsk-feedback-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  animation: dsk-particle-fly 0.85s ease-out forwards;
}

@keyframes dsk-particle-fly {
  to {
    transform: translate(var(--dx), var(--dy));
    opacity: 0;
  }
}

.dsk-level-burst {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.35), transparent 65%);
  animation: dsk-level-ring 1s ease-out;
}

@keyframes dsk-level-ring {
  from { transform: scale(0.5); opacity: 1; }
  to { transform: scale(1.5); opacity: 0; }
}

.dsk-ach-cinema {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-align: left;
}

.dsk-ach-badge {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid rgba(139, 92, 246, 0.5);
  animation: dsk-ach-pop 0.5s cubic-bezier(0.2, 1.2, 0.3, 1);
}

@keyframes dsk-ach-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* —— Chat MMORPG —— */
.chat-msg {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.25rem;
  transition: background 0.15s;
}

.chat-msg:hover {
  background: rgba(139, 92, 246, 0.08);
}

.chat-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  font-size: 0.72rem;
}

.chat-channel-tag {
  font-size: 0.6rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(75, 42, 103, 0.5);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.chat-channel-tag--clan {
  border-color: rgba(212, 175, 55, 0.4);
  color: #d4af37;
}

.chat-clan-tag {
  font-size: 0.65rem;
  color: #d4af37;
}

.chat-title-tag {
  font-size: 0.62rem;
  color: #c084fc;
  font-style: italic;
}

.chat-profile-link {
  font-weight: 700;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: #a78bfa;
}

.chat-glow--admin { text-shadow: 0 0 8px rgba(255, 77, 94, 0.6); color: #ff6b7a !important; }
.chat-glow--founder { text-shadow: 0 0 8px rgba(212, 175, 55, 0.7); color: #f5d76e !important; }
.chat-glow--legendary { text-shadow: 0 0 6px rgba(192, 132, 252, 0.5); }
.chat-glow--rank { text-shadow: 0 0 6px rgba(96, 165, 250, 0.5); color: #93c5fd !important; }

.chat-frame-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 2px;
  vertical-align: middle;
}

.chat-status-pill {
  font-size: 0.58rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: rgba(0, 217, 139, 0.15);
  color: #00d98b;
}

.chat-status-pill--exploring { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.chat-status-pill--pvp { background: rgba(255, 77, 94, 0.15); color: #ff4d5e; }
.chat-status-pill--crafting { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.chat-status-pill--afk { background: rgba(120, 120, 140, 0.2); color: #9ca3af; }
.chat-status-pill--battle { background: rgba(255, 77, 94, 0.2); color: #ff6b7a; }

/* —— Battle Pass AAA+ —— */
.bp-header,
.adf-bp-hero {
  animation: dsk-breathe-glow 5s ease-in-out infinite;
}

.bp-reward,
.adf-bp-reward-card {
  position: relative;
  overflow: hidden;
}

.bp-reward--claimable::before,
.adf-bp-reward-card:hover::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: conic-gradient(from 0deg, transparent, rgba(212, 175, 55, 0.15), transparent);
  animation: dsk-bp-spin 3s linear infinite;
  pointer-events: none;
}

@keyframes dsk-bp-spin {
  to { transform: rotate(360deg); }
}

.adf-bp-trail-rail {
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
  animation: dsk-energy-flow 2s ease-in-out infinite;
}

@keyframes dsk-energy-flow {
  0%, 100% { opacity: 0.6; filter: brightness(1); }
  50% { opacity: 1; filter: brightness(1.3); }
}

.adf-bp-tier--unlock {
  animation: dsk-tier-pop 0.5s ease;
}

@keyframes dsk-tier-pop {
  0% { transform: scale(0.85); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* —— Talent tree final —— */
.adf-tt-canvas-wrap {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(75, 42, 103, 0.35), transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(139, 92, 246, 0.15), transparent 50%),
    linear-gradient(180deg, #08080c, #12121c) !important;
}

.adf-tt-canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='10' y='30' fill='%238b5cf6' opacity='0.06' font-size='20'%3Eᚱ%3C/text%3E%3C/svg%3E");
  pointer-events: none;
  animation: dsk-rune-drift 20s linear infinite;
}

@keyframes dsk-rune-drift {
  from { background-position: 0 0; }
  to { background-position: 60px 60px; }
}

.adf-tt-line--active {
  stroke-dasharray: 8 6;
  animation: dsk-line-flow 1.5s linear infinite, adf-line-pulse 2.5s ease-in-out infinite !important;
}

@keyframes dsk-line-flow {
  to { stroke-dashoffset: -28; }
}

.adf-tt-node--available {
  animation: dsk-node-breathe 2.5s ease-in-out infinite !important;
}

@keyframes dsk-node-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.adf-tt-node--selected {
  animation: dsk-node-absorb 0.6s ease !important;
}

@keyframes dsk-node-absorb {
  0% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.8); transform: scale(1.2); }
  100% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.5); transform: scale(1.08); }
}

.talent-tree-modal-body .tt-node--unlocked {
  animation: dsk-node-breathe 3s ease-in-out infinite;
}

/* —— Exploração regiões —— */
.exp-region-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.exp-region-card[data-biome='inferno'] {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}

.exp-region-card[data-biome='swamp'] {
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

/* —— Perfil timeline —— */
.profile-timeline {
  margin: 0.65rem 0;
  padding-left: 0.75rem;
  border-left: 2px solid rgba(139, 92, 246, 0.35);
}

.profile-timeline-item {
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
  position: relative;
}

.profile-timeline-item::before {
  content: '';
  position: absolute;
  left: -0.9rem;
  top: 0.35rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-title, #d4af37);
}

.profile-record-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.profile-record-card {
  padding: 0.4rem;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  font-size: 0.7rem;
  background: rgba(13, 13, 18, 0.5);
}

.profile-record-card strong {
  display: block;
  color: #d4af37;
  font-size: 0.85rem;
}

.profile-member-since {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin: 0.25rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .dsk-feedback-card,
  .adf-tt-line--active,
  .adf-card {
    animation: none !important;
  }
}
