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

/* Remove mobile tap highlight & text selection on interactive elements */
canvas, .avatar-widget, .avatar-scene, .project-card, .btn-primary, .btn-outline, button {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

:root {
  --font-sans: 'Inter', 'Noto Sans SC', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Orbitron', 'Inter', sans-serif;
  --radius: 20px;
  --transition: 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ========== DARK THEME (default) ========== */
[data-theme="dark"] {
  --bg: #050510;
  --bg-card: rgba(10, 10, 30, 0.6);
  --bg-card-border: rgba(255, 255, 255, 0.04);
  --text: #e8e8f0;
  --text-dim: #8888aa;
  --text-muted: #484868;
  --accent: #7c5cfc;
  --accent2: #00e5ff;
  --accent3: #ff4da6;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);
  --border-subtle: rgba(255,255,255,0.03);
  --glow-1: rgba(124, 92, 252, 0.25);
  --glow-2: rgba(0, 229, 255, 0.18);
  --glow-3: rgba(255, 77, 166, 0.12);
  --header-bg: rgba(5,5,16,0.85);
  --header-border: rgba(124,92,252,0.1);
  --card-shadow: 0 30px 60px rgba(0,0,0,0.5);
  --btn-outline-border: rgba(255,255,255,0.12);
  --btn-outline-hover-bg: rgba(255,255,255,0.03);
  --noise-opacity: 0.03;
  --scan-line-bg: rgba(0,0,0,0.03);
  --grid-line-color: rgba(124,92,252,0.03);
  --tag-bg: rgba(124,92,252,0.08);
  --tag-border: rgba(124,92,252,0.15);
  --card-icon-bg: rgba(124,92,252,0.08);
  --card-icon-border: rgba(124,92,252,0.12);
  --stat-border: rgba(255,255,255,0.04);
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
  --bg: #f0f1f5;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-card-border: rgba(0, 0, 0, 0.06);
  --text: #1a1a2e;
  --text-dim: #555570;
  --text-muted: #999aae;
  --accent: #5b3fd4;
  --accent2: #007896;
  --accent3: #d6336c;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.12);
  --border-subtle: rgba(0,0,0,0.04);
  --glow-1: rgba(91, 63, 212, 0.12);
  --glow-2: rgba(0, 120, 150, 0.08);
  --glow-3: rgba(214, 51, 108, 0.06);
  --header-bg: rgba(240,241,245,0.85);
  --header-border: rgba(91,63,212,0.12);
  --card-shadow: 0 20px 50px rgba(0,0,0,0.08);
  --btn-outline-border: rgba(0,0,0,0.12);
  --btn-outline-hover-bg: rgba(91,63,212,0.04);
  --noise-opacity: 0;
  --scan-line-bg: transparent;
  --grid-line-color: rgba(91,63,212,0.04);
  --tag-bg: rgba(91,63,212,0.06);
  --tag-border: rgba(91,63,212,0.12);
  --card-icon-bg: rgba(91,63,212,0.06);
  --card-icon-border: rgba(91,63,212,0.1);
  --stat-border: rgba(0,0,0,0.05);

  /* 3D material colors (read by JS) */
  --three-knot: 0x5b3fd4;
  --three-wire: 0x5b3fd4;
  --three-ring1: 0x007896;
  --three-ring2: 0xd6336c;
  --three-knot-opacity: 0.06;
  --three-wire-opacity: 0.03;
  --three-ring1-opacity: 0.12;
  --three-ring2-opacity: 0.08;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s, color 0.5s;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); opacity: 0.3; border-radius: 2px; }

/* ---- 3D Interactive Stage ---- */
#three-stage {
  width: 100%;
  height: 100%;
  cursor: grab;
  will-change: transform;
  transform: translateZ(0);
}
#three-stage:active { cursor: grabbing; }
#three-stage canvas { display: block; }

.stage-hint {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  pointer-events: none;
  white-space: nowrap;
}

/* ---- Overlays ---- */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transition: opacity 0.5s;
}

.scan-line {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scan-line-bg) 2px,
    var(--scan-line-bg) 4px
  );
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  position: relative;
  width: 48px; height: 26px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  padding: 2px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.theme-toggle:hover { border-color: var(--accent); }

.theme-toggle-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
[data-theme="light"] .theme-toggle-thumb { transform: translateX(22px); }

.theme-toggle-icons {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  pointer-events: none;
  font-size: 11px;
}

/* ---- Header ---- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 40px;
  height: 72px;
  display: flex;
  align-items: center;
  transition: background 0.4s, border-color 0.4s;
}
.header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--header-border);
}

.header-inner {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right { display: flex; align-items: center; gap: 20px; }

.logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
}
.logo-bracket { color: var(--accent); }
.logo:hover { text-shadow: 0 0 20px var(--glow-1); }

.nav { display: flex; align-items: center; gap: 32px; }
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color 0.3s;
}
.nav-num { color: var(--accent); font-family: var(--font-mono); font-size: 11px; margin-right: 4px; }
.nav a:hover { color: var(--text); }
.nav-gh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: all 0.3s;
  color: var(--text-dim);
}
.nav-gh:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 0 16px var(--glow-1); }

/* ---- Hero ---- */
.hero {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 100px 20px 60px;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  width: 100%;
  max-width: 1320px;
  flex: 1;
}

.hero-content {
  flex: 0 0 auto;
  max-width: 520px;
  text-align: left;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}
.eyebrow-line {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
.eyebrow-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--accent);
}

.hero-title {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-reveal {
  display: block;
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.1;
}
.title-reveal .char {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  animation: charReveal 0.6s forwards;
}
.title-reveal.accent {
  background: linear-gradient(135deg, var(--accent) 20%, var(--accent2) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.hero-sub {
  font-size: 16px;
  color: var(--text-dim);
  max-width: 460px;
  margin-bottom: 40px;
  line-height: 1.7;
  animation: fadeUp 0.8s 0.5s both;
}

.hero-actions {
  display: flex;
  gap: 16px;
  animation: fadeUp 0.8s 0.7s both;
}

.hero-visual {
  flex: 1;
  max-width: 600px;
  min-width: 360px;
  height: 500px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--bg-card-border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 36px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6a3cf0);
  color: #fff;
  border: none;
  box-shadow: 0 0 30px var(--glow-1), 0 4px 20px rgba(124,92,252,0.3);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 50px var(--glow-1), 0 8px 30px rgba(124,92,252,0.4);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--btn-outline-border);
  backdrop-filter: blur(4px);
}
.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--btn-outline-hover-bg);
  transform: translateY(-3px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.hero-scroll span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-muted);
}
.scroll-line-container {
  width: 1px;
  height: 40px;
  background: var(--border-subtle);
  position: relative;
  overflow: hidden;
}
.scroll-line-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollLine 2s ease-in-out infinite;
}
@keyframes scrollLine {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* ---- Sections Common ---- */
.section-header {
  text-align: center;
  margin-bottom: 72px;
}
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 20px;
}
.tag-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.section-header h2 {
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -1px;
}

/* ---- Projects ---- */
.work {
  position: relative;
  z-index: 10;
  max-width: 1320px;
  margin: 0 auto;
  padding: 120px 40px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.project-card {
  position: relative;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  transform-style: preserve-3d;
  perspective: 1000px;
}

.project-card:hover {
  border-color: rgba(124,92,252,0.25);
  transform: translateY(-6px);
  box-shadow: var(--card-shadow), 0 0 60px var(--glow-1);
}

.card-bg-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s;
  background: radial-gradient(ellipse at var(--mx, 50%) var(--my, 50%), var(--glow-1), transparent 60%);
}
.project-card:hover .card-bg-glow { opacity: 1; }

.card-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
  background-size: 32px 32px;
}

.card-inner {
  position: relative;
  z-index: 1;
  padding: 36px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.card-index {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.card-tags { display: flex; gap: 8px; }
.tag {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: var(--tag-bg);
  color: var(--accent);
  border: 1px solid var(--tag-border);
}

.card-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  background: var(--card-icon-bg);
  border: 1px solid var(--card-icon-border);
  color: var(--accent);
}

.card-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.card-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 28px;
  flex: 1;
}

.card-stats {
  display: flex;
  gap: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--stat-border);
  border-bottom: 1px solid var(--stat-border);
  margin-bottom: 20px;
}

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-domain {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.card-arrow {
  color: var(--text-muted);
  transition: all var(--transition);
}
.project-card:hover .card-arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

/* ---- About ---- */
.about {
  position: relative;
  z-index: 10;
  max-width: 880px;
  margin: 0 auto;
  padding: 120px 40px;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.about-card {
  display: flex;
  gap: 36px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.about-avatar { position: relative; flex-shrink: 0; }
.avatar-inner {
  width: 88px; height: 88px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  color: #fff;
}
.avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  border: 1px solid var(--accent);
  opacity: 0.3;
  animation: ringPulse 3s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.04); }
}

.about-info {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-row {
  display: flex;
  gap: 20px;
  font-size: 14px;
}

.info-label {
  color: var(--text-muted);
  min-width: 48px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.info-value { color: var(--text); }
.info-value.link {
  color: var(--accent2);
  text-decoration: none;
  transition: opacity 0.3s;
}
.info-value.link:hover { opacity: 0.7; }

.about-text-wrap {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 36px 40px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 2px solid var(--accent);
}

.about-text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-dim);
}

/* ---- Footer ---- */
.footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--border-subtle);
  padding: 48px 40px 32px;
}

.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.footer-brand { display: flex; flex-direction: column; gap: 6px; }
.footer-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 2px;
}
.footer-brand p { font-size: 13px; color: var(--text-muted); }

.footer-links { display: flex; gap: 28px; }
.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.3s;
}
.footer-links a:hover { color: var(--accent); }

.footer-copy {
  width: 100%;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 8px;
  letter-spacing: 1px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header { padding: 0 20px; height: 60px; }
  .nav { gap: 16px; }
  .nav a { font-size: 11px; }
  .hero { padding: 100px 16px 60px; }
  .hero-inner { flex-direction: column; gap: 40px; }
  .hero-content { text-align: center; max-width: 100%; }
  .hero-eyebrow { justify-content: center; }
  .hero-actions { justify-content: center; }
  .hero-title .title-reveal { font-size: clamp(36px, 10vw, 52px); }
  .hero-visual { min-width: auto; max-width: 100%; height: 360px; }
  .work { padding: 80px 16px; }
  .projects-grid { grid-template-columns: 1fr; gap: 24px; }
  .about { padding: 80px 16px; }
  .about-card { flex-direction: column; text-align: center; padding: 28px; }
  .info-row { justify-content: center; }
  .about-text-wrap { padding: 28px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }
  .section-header { margin-bottom: 40px; }
  .card-inner { padding: 24px; }
}

@media (max-width: 480px) {
  .card-stats { gap: 20px; }
}

/* ---- Floating Avatar Widget ---- */
.avatar-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 200px;
  height: 220px;
  cursor: pointer;
  transition: transform 0.3s;
  will-change: transform;
  transform: translateZ(0);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}
.avatar-widget:hover { transform: scale(1.05); }
.avatar-widget:active { transform: scale(0.92); }

.avatar-scene {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle, rgba(124,92,252,0.08), transparent 70%);
}
.avatar-scene canvas { display: block; }

.avatar-hint {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity 0.5s;
}

/* Speech Bubble */
.avatar-speech {
  position: absolute;
  bottom: calc(100% - 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px var(--glow-1);
  max-width: 230px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
  z-index: 10;
}
.avatar-speech.show {
  opacity: 1;
}
.avatar-speech::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--accent);
}

/* Click action 1: Shake */
@keyframes avatarShake {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-10px) rotate(-6deg); }
  20% { transform: translateX(10px) rotate(6deg); }
  30% { transform: translateX(-7px) rotate(-4deg); }
  40% { transform: translateX(7px) rotate(4deg); }
  50% { transform: translateX(-3px) rotate(-2deg); }
  60% { transform: translateX(3px) rotate(2deg); }
  70% { transform: translateX(0); }
}
.avatar-widget.action-shake { animation: avatarShake 0.5s ease; }

/* Click action 2: Bounce up */
@keyframes avatarBounce {
  0% { transform: translateY(0) scaleX(1) scaleY(1); }
  15% { transform: translateY(-40px) scaleX(0.85) scaleY(1.15); }
  30% { transform: translateY(0) scaleX(1.1) scaleY(0.85); }
  45% { transform: translateY(-20px) scaleX(0.95) scaleY(1.05); }
  60% { transform: translateY(0) scaleX(1.05) scaleY(0.92); }
  75% { transform: translateY(-5px) scaleX(0.98) scaleY(1.02); }
  100% { transform: translateY(0) scaleX(1) scaleY(1); }
}
.avatar-widget.action-bounce { animation: avatarBounce 0.7s ease; }

/* Click action 3: Spin */
@keyframes avatarSpin {
  0% { transform: rotateZ(0) scale(1); }
  30% { transform: rotateZ(-20deg) scale(0.9); }
  60% { transform: rotateZ(380deg) scale(1.05); }
  80% { transform: rotateZ(350deg) scale(0.95); }
  100% { transform: rotateZ(360deg) scale(1); }
}
.avatar-widget.action-spin { animation: avatarSpin 0.7s ease; }

/* Click action 4: Squish */
@keyframes avatarSquish {
  0% { transform: scaleX(1) scaleY(1); }
  15% { transform: scaleX(0.65) scaleY(1.35); }
  30% { transform: scaleX(1.25) scaleY(0.75); }
  45% { transform: scaleX(0.9) scaleY(1.1); }
  60% { transform: scaleX(1.05) scaleY(0.95); }
  75% { transform: scaleX(0.97) scaleY(1.03); }
  100% { transform: scaleX(1) scaleY(1); }
}
.avatar-widget.action-squish { animation: avatarSquish 0.6s ease; }

/* Click action 5: Wobble */
@keyframes avatarWobble {
  0% { transform: rotate(0) scale(1); }
  15% { transform: rotate(8deg) scale(1.1); }
  30% { transform: rotate(-7deg) scale(0.9); }
  45% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-3deg) scale(0.95); }
  75% { transform: rotate(1deg) scale(1.02); }
  100% { transform: rotate(0) scale(1); }
}
.avatar-widget.action-wobble { animation: avatarWobble 0.65s ease; }

/* Click action 6: Drop */
@keyframes avatarDrop {
  0% { transform: translateY(-30px); opacity: 0; }
  20% { transform: translateY(0); opacity: 1; }
  30% { transform: translateY(0) scaleX(1.15) scaleY(0.8); }
  40% { transform: translateY(-10px) scaleX(0.9) scaleY(1.1); }
  55% { transform: translateY(0) scaleX(1.05) scaleY(0.92); }
  70% { transform: translateY(-3px) scaleX(0.98) scaleY(1.02); }
  85% { transform: translateY(0) scaleX(1.01) scaleY(0.99); }
  100% { transform: translateY(0) scaleX(1) scaleY(1); }
}
.avatar-widget.action-drop { animation: avatarDrop 0.7s ease; }

@media (max-width: 768px) {
  .avatar-widget {
    width: 130px;
    height: 150px;
    bottom: 14px;
    right: 10px;
  }
  .avatar-speech {
    max-width: 180px;
    font-size: 9px;
    padding: 4px 8px;
  }
}
