*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background:
    radial-gradient(circle at 15% 10%, rgba(109, 106, 255, 0.14), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(255, 103, 35, 0.10), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  scroll-behavior: smooth;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Hero ── */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 6rem;
  position: relative;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .hero {
    padding: 4rem 1.5rem;
  }
}

.hero-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 640px;
}

/* ── Profile card ── */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--card-border);
  border-radius: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  width: 100%;
  animation: fadeUp 0.6s ease both;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg,
    transparent 30%,
    rgba(109, 106, 255, 0.06) 50%,
    rgba(255, 103, 35, 0.04) 60%,
    transparent 70%
  );
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
  animation: glowSweep 3s linear infinite paused;
}

.card:hover::before {
  opacity: 1;
  animation-play-state: running;
}

.card:hover {
  border-color: rgba(109, 106, 255, 0.2);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(109, 106, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card > * { position: relative; z-index: 1; }

/* ── Banner ── */
.banner-wrap {
  width: 100%;
  height: 4.5rem;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  overflow: hidden;
  border-radius: 1.75rem 1.75rem 0 0;
  flex-shrink: 0;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.banner-img.loaded { opacity: 1; }

/* ── Card body (avatar + info) ── */
.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.25rem 1.75rem;
}

@media (min-width: 480px) {
  .card-body { padding: 0 2rem 2rem; }
}

@media (min-width: 700px) {
  .card-body {
    flex-direction: row;
    align-items: flex-start;
    padding: 0 2.25rem 2.25rem;
    gap: 1.5rem;
  }
}

/* ── Avatar ── */
.avatar-wrap {
  position: relative;
  width: 9rem;
  height: 9rem;
  flex-shrink: 0;
  margin-top: 0.75rem;
  animation: fadeUp 0.6s 0.1s ease both;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #5865F2, #FF6723);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  overflow: visible;
  z-index: 1;
}

.avatar img.pfp {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.avatar img.pfp.loaded { opacity: 1; }

.avatar img.decoration {
  position: absolute;
  inset: -12%;
  width: 124%;
  height: 124%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.avatar img.decoration.loaded { opacity: 1; }

/* ── Status dot ── */
.status-dot {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--offline);
  border: 4px solid var(--bg-2);
  z-index: 3;
  transition: background 0.3s ease;
}

.status-dot.online  { background: var(--online); }
.status-dot.idle    { background: var(--idle); }
.status-dot.dnd     { background: var(--dnd); }
.status-dot.offline { background: var(--offline); }

.status-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: pulse 2s ease-out infinite;
  background: inherit;
  opacity: 0.5;
}

.status-dot.offline::after { animation: none; }

/* ── Info block ── */
.info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: center;
  text-align: center;
  animation: fadeUp 0.6s 0.2s ease both;
  padding-top: 0.5rem;
  width: 100%;
}

@media (min-width: 700px) {
  .info {
    align-items: flex-start;
    text-align: left;
    padding-top: 1rem;
  }
}

.name-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

@media (min-width: 700px) {
  .name-row { justify-content: flex-start; }
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.status-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--button);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-pill .mini-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--offline);
}

.status-pill .mini-dot.online  { background: var(--online); }
.status-pill .mini-dot.idle    { background: var(--idle); }
.status-pill .mini-dot.dnd     { background: var(--dnd); }

.handle {
  color: #888;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.5;
  margin-top: 0.1rem;
}

/* ── Link buttons ── */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.5rem;
}

@media (min-width: 700px) {
  .links { justify-content: flex-start; }
}

.btn {
  background: var(--button);
  border: 1px solid var(--card-border);
  border-radius: 0.85rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}

.btn:hover           { background: var(--button-hover); transform: translateY(-2px); border-color: rgba(255, 255, 255, 0.14); }
.btn:active          { transform: translateY(0); }
.btn svg             { width: 17px; height: 17px; flex-shrink: 0; }
.btn.discord:hover   { border-color: #5865F2; }
.btn.github:hover    { border-color: rgba(255, 255, 255, 0.27); }
.btn.spotify:hover   { border-color: rgba(29, 185, 84, 0.27); }

.btn-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  color: var(--text-secondary);
}

.btn-disabled:hover {
  background: var(--button);
  transform: none;
  border-color: var(--card-border);
}

/* ── Game / activity presence card ── */
.game-card {
  display: none;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid rgba(109, 106, 255, 0.18);
  width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.game-card.visible {
  display: flex;
  animation: spotifyReveal 0.35s ease both;
}

.game-card:hover { border-color: rgba(109, 106, 255, 0.32); }

.game-art-wrap {
  position: relative;
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
}

.game-art {
  width: 100%;
  height: 100%;
  border-radius: 0.6rem;
  object-fit: cover;
  background: var(--button);
  display: block;
}

.game-art-small {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--button);
  border: 2px solid var(--bg-2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: none;
}

.game-art-small.loaded { display: block; }

.game-meta {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.game-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.game-label svg { width: 0.85rem; height: 0.85rem; }

.game-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-details {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.1rem;
}

.game-time {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Spotify presence card ── */
.spotify-card {
  display: none;
  gap: 0.85rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid rgba(30, 215, 96, 0.18);
  width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.spotify-card.visible {
  display: flex;
  animation: spotifyReveal 0.35s ease both;
}

.spotify-card:hover { border-color: rgba(30, 215, 96, 0.32); }

.spotify-art {
  width: 3.5rem;
  height: 3.5rem;
  min-width: 3.5rem;
  border-radius: 0.6rem;
  object-fit: cover;
  flex-shrink: 0;
  background: #1a1a1a;
  animation: artPulse 3s ease-in-out infinite;
  transition: transform 0.2s ease;
}

.spotify-card:hover .spotify-art { transform: scale(1.06); }

.spotify-meta {
  min-width: 0;
  flex: 1;
}

.spotify-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #1ED760;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.spotify-label svg { width: 0.85rem; height: 0.85rem; }

.spotify-song {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spotify-artist {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.4rem;
}

.spotify-progress {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.spotify-bar-track {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.spotify-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1ED760 0%, #4ade80 48%, #1ED760 100%);
  background-size: 200% 100%;
  border-radius: 2px;
  animation: barShimmer 2.4s linear infinite;
  transition: width 0.9s linear;
}

.spotify-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* ── Scroll hint ── */
.scroll-hint-wrap {
  position: absolute;
  bottom: 2rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.scroll-hint {
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: max-content;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid rgba(109, 106, 255, 0.3);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  animation: fadeUp 0.6s 0.5s ease both, scrollHintPulse 2.2s ease-in-out infinite;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.scroll-hint p {
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.scroll-hint svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--accent);
  animation: scrollBounce 1.6s ease-in-out infinite;
}

.scroll-hint:hover {
  border-color: var(--accent);
  transform: translateY(2px);
}

/* ── Projects section ── */
.projects {
  padding: 4rem 1.25rem 5rem;
  max-width: 900px;
  margin: 0 auto;
}

@media (min-width: 480px) {
  .projects { padding: 4rem 1.5rem 5rem; }
}

.projects h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.projects .sub {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.projects h2,
.projects .sub {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.projects h2.revealed,
.projects .sub.revealed {
  opacity: 1;
  transform: translateY(0);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  justify-items: center;
  align-items: stretch;
}

@media (min-width: 750px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: stretch;
  }
  .grid .project-card { height: 100%; }
}

/* ── Project cards ── */
.project-card {
  --glow-1: 88, 101, 242;
  --glow-2: 139, 92, 246;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--card-border);
  border-radius: 1.5rem;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  align-items: center;
  text-align: center;
  height: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease, box-shadow 0.3s ease, transform 0.22s ease;
  opacity: 0;
  transform: translateY(22px);
  position: relative;
  width: 100%;
}

.project-card.revealed {
  animation: projectReveal 0.5s ease both;
  opacity: 1 !important;
  transform: translateY(0);
}

.project-card.revealed:nth-child(2) { animation-delay: 0.08s; }
.project-card.revealed:nth-child(3) { animation-delay: 0.16s; }
.project-card.revealed:nth-child(4) { animation-delay: 0.24s; }

.project-card > * { position: relative; z-index: 1; }

.project-card.p1-card { --glow-1: 88, 101, 242;  --glow-2: 139, 92, 246; }
.project-card.p2-card { --glow-1: 234, 88, 12;   --glow-2: 245, 158, 11; }
.project-card.p3-card { --glow-1: 29, 185, 84;   --glow-2: 74, 222, 128; }
.project-card.p4-card { --glow-1: 236, 72, 153;  --glow-2: 99, 102, 241; }

.project-card--stacked .project-info p { max-width: 340px; }

.project-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  width: 100%;
}

.project-info .project-links {
  margin-top: auto;
  padding-top: 0.6rem;
}

.project-info h3      { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.35rem; }
.project-info p       { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 0.85rem; line-height: 1.5; }

.project-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-avatar svg { width: 2rem; height: 2rem; }

.p1 { background: linear-gradient(135deg, #5865F2, #8b5cf6); }
.p2 { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.p3 { background: linear-gradient(135deg, #1DB954, #14532d); }
.p4 { background: linear-gradient(135deg, #ec4899, #6366f1); }

.project-links        { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.project-links .btn   { font-size: 0.75rem; padding: 0.42rem 0.75rem; }

/* ── Themed project button hover states ── */
.project-links .btn {
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.p1-card .project-links .btn:hover,
.p1-card .project-links .btn:active {
  border-color: rgba(88, 101, 242, 0.55);
  background: rgba(88, 101, 242, 0.14);
  color: #fff;
  box-shadow: 0 0 16px -2px rgba(88, 101, 242, 0.45);
}

.p2-card .project-links .btn:hover,
.p2-card .project-links .btn:active {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.14);
  color: #fff;
  box-shadow: 0 0 16px -2px rgba(245, 158, 11, 0.45);
}

.p3-card .project-links .btn:hover,
.p3-card .project-links .btn:active {
  border-color: rgba(29, 185, 84, 0.55);
  background: rgba(29, 185, 84, 0.14);
  color: #fff;
  box-shadow: 0 0 16px -2px rgba(29, 185, 84, 0.45);
}

.p4-card .project-links .btn:hover,
.p4-card .project-links .btn:active {
  border-color: rgba(236, 72, 153, 0.55);
  background: rgba(236, 72, 153, 0.14);
  color: #fff;
  box-shadow: 0 0 16px -2px rgba(236, 72, 153, 0.45);
}

.p4-card .project-links .btn-disabled:hover,
.p4-card .project-links .btn-disabled:active {
  border-color: var(--card-border);
  background: var(--button);
  color: var(--text-secondary);
  box-shadow: none;
}

/* ── Hover effects (pointer devices only) ── */
@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--glow-1), 0.55);
    box-shadow:
      0 18px 40px rgba(0, 0, 0, 0.5),
      0 0 0 1px rgba(var(--glow-1), 0.35),
      0 0 24px 2px rgba(var(--glow-1), 0.35),
      0 0 46px 6px rgba(var(--glow-2), 0.22);
  }
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  border-top: 1px solid var(--card-border);
}

/* ── Loading screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: 1rem;
  z-index: 9998;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 0.7rem 1.1rem 0.6rem;
  border-radius: 0.9rem;
  font-size: 0.82rem;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s ease;
  overflow: hidden;
}

@media (min-width: 480px) {
  .toast {
    left: auto;
    top: 1.5rem;
    right: 1.5rem;
    min-width: 240px;
    transform: translateX(24px);
  }
}

.toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (min-width: 480px) {
  .toast.visible { transform: translateX(0); }
}

.toast-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.toast-check {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--online);
  filter: drop-shadow(0 0 6px rgba(35, 165, 90, 0.55));
}

.toast.toast-error .toast-check {
  color: var(--dnd);
  filter: drop-shadow(0 0 6px rgba(242, 63, 67, 0.55));
}

.toast-msg { white-space: nowrap; }

.toast-progress-track {
  margin-top: 0.5rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.toast-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: var(--online);
  box-shadow: 0 0 8px rgba(35, 165, 90, 0.6);
}

.toast.toast-error .toast-progress-fill {
  background: var(--dnd);
  box-shadow: 0 0 8px rgba(242, 63, 67, 0.6);
}

.toast-accent {
  color: var(--online);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(35, 165, 90, 0.45);
}

.toast-highlight {
  color: var(--dnd);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(242, 63, 67, 0.45);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
