/* ===========================
   VARIABLES & RESET
   =========================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,600;1,9..40,300&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg:        #1a1c1f;
  --surface:   rgba(30, 32, 37, 0.72);
  --border:    rgba(255, 255, 255, 0.07);
  --text:      #e8eaed;
  --muted:     #8b8fa8;
  --accent:    #5865f2;

  --online:    #3ba55c;
  --idle:      #faa61a;
  --dnd:       #ed4245;
  --offline:   #747f8d;

  --radius-card: 20px;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}

/* ===========================
   CANVAS BACKGROUND
   =========================== */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===========================
   MAIN LAYOUT
   =========================== */
.main {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%; height: 100vh;
  padding-top: clamp(4rem, 12vh, 9rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-bottom: 1.5rem;
}

/* ===========================
   PROFILE CARD
   =========================== */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;

  width: min(380px, 100%);
  padding: 2.5rem 2rem 2rem;

  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);

  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 24px 64px rgba(0,0,0,0.55),
    0 4px 16px rgba(0,0,0,0.3);

  opacity: 0;
  transform: translateY(-60px) scale(0.97);
  animation: cardIn 0.85s cubic-bezier(0.34, 1.4, 0.64, 1) 1s forwards;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===========================
   AVATAR  — perfect circle, immune to flex stretching
   =========================== */
.avatar-wrap {
  position: relative;
  /* Hard pixel values on all sides — flex cannot override these */
  width: 110px !important;
  height: 110px !important;
  min-width: 110px !important;
  min-height: 110px !important;
  max-width: 110px !important;
  max-height: 110px !important;
  flex: 0 0 110px;
  align-self: center;
}

#avatar-img {
  display: block;
  /* Same hard pixel values */
  width: 110px !important;
  height: 110px !important;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  background: #2b2d31;
  transition: opacity 0.4s ease;
}

/* Ring de color según estado */
.status-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: transparent;
  transition: border-color 0.6s ease, box-shadow 0.6s ease;
  pointer-events: none;
}

.status-ring.online  { border-color: var(--online);  box-shadow: 0 0 16px rgba(59,165,92,0.4); }
.status-ring.idle    { border-color: var(--idle);    box-shadow: 0 0 16px rgba(250,166,26,0.4); }
.status-ring.dnd     { border-color: var(--dnd);     box-shadow: 0 0 16px rgba(237,66,69,0.4); }
.status-ring.offline { border-color: var(--offline); box-shadow: none; }

/* Dot de estado */
.status-dot {
  position: absolute;
  bottom: 3px; right: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 4px solid #1e2025;
  background-color: var(--offline);
  transition: background-color 0.5s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.status-dot.online  { background-color: var(--online); }

.status-dot.idle    { background-color: var(--idle); overflow: hidden; }
.status-dot.idle::before {
  content: "";
  position: absolute;
  top: -3px; left: -2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background-color: #1e2025;
}

.status-dot.dnd { background-color: var(--dnd); }
.status-dot.dnd::after {
  content: "";
  width: 60%; height: 18%;
  background: #1e2025;
  border-radius: 10px;
}

.status-dot.offline { background-color: var(--offline); }
.status-dot.offline::after {
  content: "";
  width: 42%; height: 42%;
  background: #1e2025;
  border-radius: 50%;
}

/* ===========================
   CARD INFO
   =========================== */
.card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: center;
}

.username {
  font-family: 'Space Mono', monospace;
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.display-name {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* ===========================
   CUSTOM STATUS
   =========================== */
.custom-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.85rem;
  margin-top: 0.3rem;
  max-width: 100%;
  transition: opacity 0.4s;
}

.custom-status-emoji { font-size: 1rem; line-height: 1; flex-shrink: 0; }

.custom-status-text {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* ===========================
   STATUS BADGE
   =========================== */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.2rem;
}

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--offline);
  flex-shrink: 0;
  transition: background 0.5s ease;
}

.badge-dot.online  { background: var(--online); }
.badge-dot.idle    { background: var(--idle); }
.badge-dot.dnd     { background: var(--dnd); }
.badge-dot.offline { background: var(--offline); }

.badge-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.5s ease;
}

.badge-label.online  { color: var(--online); }
.badge-label.idle    { color: var(--idle); }
.badge-label.dnd     { color: var(--dnd); }
.badge-label.offline { color: var(--offline); }

/* ===========================
   DIVIDER LINE
   =========================== */
.card::after {
  content: "";
  position: absolute;
  top: 0; left: 15%;
  width: 70%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  border-radius: 1px;
}

/* ===========================
   TYPEWRITER
   =========================== */
.typewriter-wrap {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 2rem;
  opacity: 0;
  animation: cardIn 0.6s ease 1.6s forwards;
}

.typewriter-text {
  font-family: 'Space Mono', monospace;
  font-size: clamp(0.8rem, 2.5vw, 0.95rem);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: middle;
  border-radius: 1px;
  animation: blink 0.75s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 420px) {
  .card { padding: 2rem 1.4rem 1.6rem; gap: 1.2rem; }
  .avatar-wrap {
    width: 90px !important; height: 90px !important;
    min-width: 90px !important; min-height: 90px !important;
    max-width: 90px !important; max-height: 90px !important;
    flex: 0 0 90px;
  }
  #avatar-img { width: 90px !important; height: 90px !important; }
  .status-dot { width: 22px; height: 22px; border-width: 3px; }
}

@media (min-width: 900px) {
  .card {
    flex-direction: row;
    align-items: center;
    text-align: left;
    width: min(520px, 90%);
    padding: 2.2rem 2.5rem;
    gap: 2rem;
  }
  .card-info { align-items: flex-start; text-align: left; }
}
