/* ===================== ROOT VARS ===================== */
:root {
  --bg: #080808;
  --bg2: #0e0e0e;
  --bg3: #141414;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --white: #f0f0f0;
  --muted: #666;
  --accent: #a78bfa;
  --accent2: #38bdf8;
  --glow: rgba(167, 139, 250, 0.18);
  --glow2: rgba(56, 189, 248, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "DM Sans", sans-serif;
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================== RESET ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  font-size: 16px;
}
body {
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}
button {
  cursor: none;
  font-family: var(--font-body);
  border: none;
  background: none;
}

/* ===================== CUSTOM CURSOR ===================== */
#cursor {
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition:
    transform 0.1s ease,
    width 0.2s ease,
    height 0.2s ease,
    background 0.2s ease;
  mix-blend-mode: screen;
}
#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(167, 139, 250, 0.4);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition:
    transform 0.15s ease,
    width 0.25s ease,
    height 0.25s ease,
    opacity 0.2s ease;
}
.cursor-hover #cursor {
  width: 20px;
  height: 20px;
  background: var(--accent2);
}
.cursor-hover #cursor-ring {
  width: 52px;
  height: 52px;
  border-color: var(--accent2);
  opacity: 0.5;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 99px;
}

/* ===================== NOISE OVERLAY ===================== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  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)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

/* ===================== SECTION BASE ===================== */
section {
  position: relative;
  z-index: 1;
}
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===================== FADE IN ON SCROLL ===================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 {
  transition-delay: 0.1s;
}
.reveal-delay-2 {
  transition-delay: 0.2s;
}
.reveal-delay-3 {
  transition-delay: 0.3s;
}

/* ===================== SECTION LABEL ===================== */
.section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--card-border), transparent);
}

/* ===================== HERO ===================== */
#hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
}
.hero-bg-glow {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(167, 139, 250, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.hero-bg-glow2 {
  position: absolute;
  bottom: 10%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(56, 189, 248, 0.07) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.avatar-wrap {
  position: relative;
  margin-bottom: 28px;
}
.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--card-border);
  position: relative;
  z-index: 1;
  /* placeholder gradient */
  background: linear-gradient(135deg, #1e1e2e, #2d2d44);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}
.avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.4;
  animation: pulse-ring 3s ease-in-out infinite;
}
.avatar-ring2 {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid var(--accent2);
  opacity: 0.2;
  animation: pulse-ring 3s ease-in-out infinite 1s;
}
@keyframes pulse-ring {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.05);
  }
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 52px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 12px;
}
.hero-name span {
  background: linear-gradient(135deg, var(--white) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-tagline {
  font-size: 15px;
  color: var(--muted);
  font-weight: 300;
  max-width: 300px;
  margin: 0 auto 32px;
  line-height: 1.7;
}
.hero-tagline em {
  color: var(--accent);
  font-style: normal;
}
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: bounce 2s ease-in-out infinite;
}
.scroll-hint svg {
  opacity: 0.4;
}
@keyframes bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* ===================== SOCIAL ===================== */
#social {
  padding: 80px 0;
}
.social-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.social-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  cursor: none;
}
.social-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--glow), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.social-card:hover::before,
.social-card:active::before {
  opacity: 1;
}
.social-card:hover {
  border-color: rgba(167, 139, 250, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(167, 139, 250, 0.1);
}
.social-card:active {
  transform: scale(0.97);
}
.social-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  position: relative;
  z-index: 1;
}
.social-info {
  position: relative;
  z-index: 1;
}
.social-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--white);
  display: block;
}
.social-handle {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}
.social-card.wide {
  grid-column: 1 / -1;
}
.social-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}
.social-card:hover .social-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

/* ===================== GALLERY ===================== */
#gallery {
  padding: 80px 0;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.gallery-item {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  cursor: none;
  background: var(--bg3);
  border: 1px solid var(--card-border);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.gallery-item:hover img {
  transform: scale(1.05);
}
.gallery-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gallery-item:hover::after {
  opacity: 1;
}
.gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  opacity: 0.3;
}

/* Modal */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}
#modal.open {
  opacity: 1;
  pointer-events: all;
}
#modal img {
  max-width: 100%;
  max-height: 90dvh;
  border-radius: var(--radius);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  object-fit: contain;
}
#modal.open img {
  transform: scale(1);
}
#modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 18px;
  cursor: none;
  transition: var(--transition);
}
#modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===================== GAMES ===================== */
#games {
  padding: 80px 0;
}
.games-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.games-tabs::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  padding: 10px 20px;
  border-radius: 99px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--card-border);
  background: var(--card);
  transition: var(--transition);
  white-space: nowrap;
  cursor: none;
}
.tab-btn.active,
.tab-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.08);
}
.game-panel {
  display: none;
}
.game-panel.active {
  display: block;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.game-card::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--glow), transparent);
  pointer-events: none;
}

/* Tic Tac Toe */
.ttt-status {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 20px;
  min-height: 20px;
  font-weight: 600;
}
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 240px;
  margin: 0 auto 20px;
}
.ttt-cell {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  cursor: none;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.ttt-cell:hover:empty {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.3);
}
.ttt-cell.x {
  color: var(--accent);
}
.ttt-cell.o {
  color: var(--accent2);
}
.ttt-cell.win {
  background: rgba(167, 139, 250, 0.15);
  border-color: var(--accent);
  animation: win-glow 0.5s ease forwards;
}
@keyframes win-glow {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
.game-btn {
  padding: 10px 24px;
  border-radius: 99px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.game-btn:hover {
  background: rgba(167, 139, 250, 0.2);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.2);
}
.game-btn:active {
  transform: scale(0.97);
}

/* Click Speed Test */
.cst-target {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(167, 139, 250, 0.1);
  border: 2px solid rgba(167, 139, 250, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  cursor: none;
  transition:
    background 0.1s ease,
    transform 0.1s ease;
  position: relative;
}
.cst-target:active,
.cst-target.hit {
  background: rgba(167, 139, 250, 0.25);
  transform: scale(0.95);
}
.cst-count {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.cst-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cst-timer-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 20px;
}
.cst-timer-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent2), var(--accent));
  border-radius: 99px;
  width: 100%;
  transition: width 0.1s linear;
}
.cst-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.cst-stat {
  font-size: 12px;
  color: var(--muted);
}
.cst-stat span {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--white);
}

/* Memory Game */
.mem-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.mem-card {
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: none;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}
.mem-card.flipped {
  transform: rotateY(180deg);
}
.mem-card-face {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  font-size: 24px;
}
.mem-card-back {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  transition: background 0.2s ease;
}
.mem-card:hover .mem-card-back {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.2);
}
.mem-card-front {
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.3);
  transform: rotateY(180deg);
}
.mem-card.matched .mem-card-front {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}
.mem-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.mem-stats span {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
}

/* ===================== CHAT ===================== */
#chat {
  padding: 80px 0;
}
.chat-wrap {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.chat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.chat-header-text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}
.chat-online {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}
.chat-messages {
  height: 320px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--card-border) transparent;
}
.chat-messages::-webkit-scrollbar {
  width: 3px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 99px;
}
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: msg-in 0.3s ease forwards;
  opacity: 0;
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.chat-msg-name {
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-msg-time {
  color: var(--muted);
  font-weight: 400;
  font-family: var(--font-body);
}
.chat-msg-bubble {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  border-radius: 0 12px 12px 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-break: break-word;
}
.chat-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: auto;
  padding: 40px 0;
}
.chat-empty svg {
  margin: 0 auto 12px;
  opacity: 0.3;
}
.chat-name-input-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
}
.chat-name-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.chat-name-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
  max-width: 160px;
}
.chat-name-input:focus {
  border-color: rgba(167, 139, 250, 0.4);
}
.chat-input-wrap {
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.01);
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--white);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  transition: border-color 0.2s ease;
  line-height: 1.5;
}
.chat-input:focus {
  border-color: rgba(167, 139, 250, 0.4);
}
.chat-input::placeholder {
  color: var(--muted);
}
.chat-send {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  transition: var(--transition);
  flex-shrink: 0;
  color: #0a0a0a;
}
.chat-send:hover {
  background: #c4b5fd;
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.3);
}
.chat-send:active {
  transform: scale(0.95);
}
.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chat-char-count {
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  padding: 0 16px 8px;
}
.chat-char-count.warn {
  color: #f87171;
}
.chat-cooldown-bar {
  height: 2px;
  background: transparent;
  transition: background 0.2s ease;
}
.chat-cooldown-bar.active {
  background: linear-gradient(to right, var(--accent2), var(--accent));
  animation: cooldown-shrink 4s linear forwards;
}
@keyframes cooldown-shrink {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}
.chat-firebase-notice {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}
.chat-firebase-notice a {
  color: var(--accent);
  text-decoration: underline;
}

/* ===================== FOOTER ===================== */
footer {
  padding: 40px 20px;
  text-align: center;
  border-top: 1px solid var(--card-border);
  position: relative;
  z-index: 1;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s ease;
  cursor: none;
}
.footer-link:hover {
  color: var(--accent);
}
.footer-copy {
  margin-top: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.12);
  letter-spacing: 0.05em;
}

/* ===================== MOBILE ===================== */
@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .mem-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
  .mem-card-face {
    font-size: 18px;
  }
}
