/* ── Kaedehara V3 — Ambient Presence Styles ──────────────── */

:root {
  --bg-primary: #07090e;
  --bg-secondary: #0f1217;
  --bg-tertiary: #1a1e25;
  --text-primary: #e8e8f0;
  --text-secondary: #8b8fa3;
  --text-soft: #a0a4b8;
  --text-muted: #5a5e72;
  --accent: #7c7cff;
  --accent-dim: #4a4a8a;
  --accent-glow: rgba(124, 124, 255, 0.15);
  --success: #4aff7c;
  --warning: #ffaa4a;
  --danger: #ff4a6a;
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.12);
  --card-bg: rgba(255, 255, 255, 0.025);
  --card-hover: rgba(255, 255, 255, 0.04);
  --radius: 0;
  --radius-sm: 0;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', sans-serif;
  --transition: 300ms ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Ambient Background ─────────────────────────────────── */

#ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(30, 30, 60, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(60, 30, 80, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(20, 40, 70, 0.2) 0%, transparent 50%),
    var(--bg-primary);
  animation: ambientDrift 30s ease-in-out infinite alternate;
}

#ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

@keyframes ambientDrift {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.04) translate(-8px, -8px); }
}

/* ── Layout ──────────────────────────────────────────────── */

#presence {
  padding: 16px;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  #presence {
    padding: 24px;
    grid-template-columns: 290px 1fr;
  }
}

/* ── Profile Panel (shared card style) ──────────────────── */

.profile-panel {
  border: 1px solid var(--border);
  background: var(--card-bg);
  transition: var(--transition);
}

.animated-frame {
  border: 1px solid var(--border-light);
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Hero Section ────────────────────────────────────────── */

#hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
}

#hero-avatar-frame {
  width: 112px;
  height: 112px;
  border: 1px solid var(--border-light);
  background: #000;
  padding: 3px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#hero-avatar-frame:hover {
  transform: scale(1.015);
}

#hero-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#hero-info {
  min-width: 0;
  flex: 1;
}

#hero-name {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  #hero-name { font-size: 36px; }
}

#hero-tagline {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
}

#hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-soft);
}

#hero-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

#hero-status .dot.online { background: var(--success); }
#hero-status .dot.idle { background: var(--warning); }
#hero-status .dot.dnd { background: var(--danger); }
#hero-status .dot.offline { background: var(--text-muted); }

/* ── Social Links ────────────────────────────────────────── */

#social-links {
  padding: 16px;
}

#social-links .section-title {
  margin-bottom: 12px;
}

.social-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  width: 100%;
  text-align: left;
  color: var(--text-soft);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px;
}

.social-item:hover {
  border-color: var(--border-light);
  background: var(--card-hover);
}

.social-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.social-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Section Headers ────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.section-header .section-title {
  font-size: 11px;
}

/* ── Discord Presence ────────────────────────────────────── */

#presence-content {
  padding: 12px 16px 16px;
}

.discord-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.user-display-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.user-username {
  font-size: 12px;
  color: var(--text-secondary);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.user-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-status .dot.online { background: var(--success); }
.user-status .dot.idle { background: var(--warning); }
.user-status .dot.dnd { background: var(--danger); }
.user-status .dot.offline { background: var(--text-muted); }

.user-status-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

/* ── Activity Items ─────────────────────────────────────── */

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}

.activity-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.activity-name {
  font-size: 13px;
  color: var(--text-primary);
}

.activity-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: auto;
}

/* ── Spotify ─────────────────────────────────────────────── */

#spotify-section {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#spotify-section.hidden {
  display: none;
}

#spotify-album-art {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

#spotify-track {
  flex: 1;
  min-width: 0;
}

#spotify-track-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#spotify-track-artist {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#spotify-progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  border-radius: 2px;
  overflow: hidden;
}

#spotify-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  border-radius: 2px;
  transition: width 1s linear;
}

/* ── Steam ───────────────────────────────────────────────── */

#steam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

#steam-games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 16px;
}

@media (min-width: 640px) {
  #steam-games-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steam-game-card {
  border: 1px solid var(--border-light);
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
  transition: transform var(--transition);
}

.steam-game-card:hover {
  transform: translateY(-2px) scale(1.01);
}

.steam-game-artwork {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  display: block;
}

.steam-game-artwork.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
}

.steam-game-body {
  padding: 12px;
}

.steam-game-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steam-game-meta {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}

.steam-game-last {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

#steam-total {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 16px 16px;
}

/* ── AniList ─────────────────────────────────────────────── */

#anilist-section-outer {
  padding: 0 16px 16px;
}

.anilist-block {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.anilist-block:last-child {
  margin-bottom: 0;
}

.anilist-block-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.anilist-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  padding: 4px 0;
}

.anilist-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.anilist-dot.active { background: var(--success); }
.anilist-dot.inactive { background: var(--danger); }

.anilist-activity {
  font-size: 12px;
  color: var(--text-soft);
  padding: 4px 0 4px 12px;
  border-left: 1px solid var(--border);
  margin-bottom: 4px;
}

.anilist-activity:last-child {
  margin-bottom: 0;
}

.anilist-activity-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ── Empty/Muted states ─────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.muted-text {
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 480px) {
  #presence {
    padding: 8px;
    gap: 10px;
  }

  #hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  #hero-avatar-frame {
    width: 80px;
    height: 80px;
  }

  #hero-name {
    font-size: 22px;
  }

  #steam-games-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Transitions ─────────────────────────────────────────── */

.fade-in {
  animation: fadeIn 600ms ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}