/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Purple Digital Theme Colors */
  --primary-purple: #8b5cf6;
  --secondary-purple: #a855f7;
  --dark-purple: #6d28d9;
  --light-purple: #c4b5fd;
  --neon-purple: #d946ef;
  --cyber-purple: #9333ea;

  /* Background Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-accent: #f8fafc;

  /* Effects */
  --glow-purple: 0 0 20px rgba(139, 92, 246, 0.5);
  --glow-neon: 0 0 30px rgba(217, 70, 239, 0.7);
  --blur-bg: rgba(10, 10, 15, 0.8);

  /* Fonts */
  --font-primary: "Orbitron", monospace;
  --font-secondary: "Space Mono", monospace;

  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-secondary);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
  cursor: none;
  width: 100%;
  max-width: 100vw;
  position: relative;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    var(--bg-secondary) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 1s ease-out, visibility 1s ease-out;
}

.loading-container {
  text-align: center;
  position: relative;
  z-index: 2;
}

.cyber-logo {
  margin-bottom: 3rem;
}

.cyber-text {
  font-family: var(--font-primary);
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: var(--glow-purple);
  animation: cyberpulse 2s ease-in-out infinite;
}

.cyber-subtitle {
  font-family: var(--font-secondary);
  font-size: 1rem;
  color: var(--light-purple);
  letter-spacing: 0.3rem;
  margin-top: 0.5rem;
  opacity: 0.8;
}

.loading-bar-container {
  width: 300px;
  margin: 2rem auto;
}

.loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(139, 92, 246, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-purple), var(--neon-purple));
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: var(--glow-purple);
}

.loading-percentage {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-family: var(--font-primary);
}

.loading-status {
  color: var(--light-purple);
  font-size: 0.9rem;
  margin-top: 1rem;
  opacity: 0.7;
}

.matrix-rain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Background Effects */
.bg-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.neural-network {
  position: absolute;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="neural" patternUnits="userSpaceOnUse" width="50" height="50"><circle cx="25" cy="25" r="1" fill="%238b5cf6" opacity="0.3"/><line x1="25" y1="25" x2="75" y2="25" stroke="%238b5cf6" stroke-width="0.5" opacity="0.2"/><line x1="25" y1="25" x2="25" y2="75" stroke="%238b5cf6" stroke-width="0.5" opacity="0.2"/></pattern></defs><rect width="100" height="100" fill="url(%23neural)"/></svg>')
    repeat;
  opacity: 0.1;
  animation: neuralMove 20s linear infinite;
}

.digital-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    var(--primary-purple) 1px,
    transparent 1px
  );
  background-size: 50px 50px;
  opacity: 0.1;
  animation: particleFloat 15s ease-in-out infinite;
}

.grid-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
      rgba(139, 92, 246, 0.1) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(139, 92, 246, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridShift 10s linear infinite;
}

/* Navigation */
.cyber-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  z-index: 1000;
  transition: var(--transition-smooth);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.nav-logo {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.logo-bracket {
  color: var(--primary-purple);
  animation: bracketGlow 2s ease-in-out infinite;
  display: inline-block;
  line-height: 1;
  transform: none;
  writing-mode: horizontal-tb;
}

.logo-text {
  margin: 0 0.2rem;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  line-height: 1;
}

.nav-menu {
  display: flex;
  gap: 2rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
  position: relative;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
}

.nav-link:hover {
  color: var(--primary-purple);
  border-color: var(--primary-purple);
  box-shadow: var(--glow-purple);
  transform: translateY(-2px);
}

.nav-link.active {
  color: var(--primary-purple);
  border-color: var(--primary-purple);
  background: rgba(139, 92, 246, 0.1);
}

.nav-icon {
  font-size: 0.8rem;
  opacity: 0.7;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle span {
  width: 25px;
  height: 2px;
  background: var(--primary-purple);
  transition: var(--transition-smooth);
}

/* Section Styles */
section {
  min-height: 100vh;
  padding: 8rem 2rem 4rem;
  position: relative;
}

.section-container {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 0 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 4rem;
}

.section-number {
  font-family: var(--font-primary);
  font-size: 1rem;
  color: var(--primary-purple);
  letter-spacing: 0.2rem;
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-primary);
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  text-shadow: var(--glow-purple);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  opacity: 0.8;
}

/* Hero Section */
.hero-section {
  display: flex;
  align-items: center;
  min-height: 100vh;
  background: radial-gradient(
    ellipse at center,
    rgba(139, 92, 246, 0.1) 0%,
    transparent 70%
  );
}

.hero-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-greeting {
  font-size: 1.2rem;
  color: var(--primary-purple);
  margin-bottom: 1rem;
  height: 1.5rem;
  width: 100%;
  overflow: hidden;
  position: relative;
  transform: translateZ(0); /* GPU加速でちらつき防止 */
}

.typing-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 1.5rem;
  display: block;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  font-family: var(--font-secondary);
  font-size: 1.2rem;
  line-height: 1.5rem;
  transform: translateZ(0); /* GPU加速でちらつき防止 */
  will-change: contents; /* ブラウザにテキスト変更を予告 */
}

.hero-name {
  font-family: var(--font-primary);
  font-size: 4rem;
  font-weight: 900;
  margin-bottom: 1rem;
  position: relative;
}

.name-bracket {
  color: var(--primary-purple);
  animation: bracketGlow 2s ease-in-out infinite;
}

.name-text {
  margin: 0 0.3rem;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.holographic-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(139, 92, 246, 0.3),
    transparent
  );
  animation: hologramScan 4s ease-in-out infinite;
  pointer-events: none;
}

.hero-subtitle {
  margin-bottom: 2rem;
  position: relative;
}

.subtitle-text {
  font-family: var(--font-primary);
  font-size: 1.2rem;
  color: var(--text-secondary);
  letter-spacing: 0.1rem;
}

.subtitle-underline {
  height: 2px;
  background: linear-gradient(90deg, var(--primary-purple), transparent);
  margin-top: 0.5rem;
  animation: underlineExpand 2s ease-out;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-item {
  background: rgba(139, 92, 246, 0.1);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: var(--transition-smooth);
}

.stat-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow-purple);
}

.stat-label {
  font-family: var(--font-primary);
  font-size: 0.8rem;
  color: var(--primary-purple);
  display: block;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 700;
}

.hero-cta {
  margin-bottom: 2rem;
}

/* Cyber Button */
.cyber-button {
  position: relative;
  padding: 1rem 2rem;
  background: transparent;
  border: 2px solid var(--primary-purple);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  overflow: hidden;
  text-transform: uppercase;
}

.cyber-button:hover {
  color: var(--bg-primary);
  box-shadow: var(--glow-purple);
  transform: translateY(-3px);
}

.cyber-button:hover .button-scan {
  left: 100%;
}

.cyber-button:hover .button-glitch {
  opacity: 1;
  animation: glitch 0.3s ease-in-out;
}

.button-text {
  position: relative;
  z-index: 2;
}

.button-glitch {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  color: var(--neon-purple);
  z-index: 3;
}

.button-scan {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-purple),
    transparent
  );
  transition: left 0.5s ease;
  z-index: 1;
}

.cyber-button.primary:hover {
  background: var(--primary-purple);
}

/* Hologram Container */
.hologram-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 500px;
}

.hologram-frame {
  position: relative;
  width: 400px;
  height: 400px;
  border: 2px solid var(--primary-purple);
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hologram-content {
  position: relative;
  z-index: 2;
}

.avatar-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-sphere {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sphere-inner {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow: var(--glow-purple);
}

.avatar-initial {
  font-family: var(--font-primary);
  font-size: 4rem;
  font-weight: 900;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.sphere-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.ring {
  position: absolute;
  border: 1px solid var(--primary-purple);
  border-radius: 50%;
  opacity: 0.6;
  animation: ringRotate 8s linear infinite;
}

.ring-1 {
  width: 180px;
  height: 180px;
  top: -90px;
  left: -90px;
  animation-delay: 0s;
}

.ring-2 {
  width: 220px;
  height: 220px;
  top: -110px;
  left: -110px;
  animation-delay: -2s;
}

.ring-3 {
  width: 260px;
  height: 260px;
  top: -130px;
  left: -130px;
  animation-delay: -4s;
}

.data-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stream-line {
  position: absolute;
  width: 2px;
  height: 100px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--primary-purple),
    transparent
  );
  animation: streamFlow 2s ease-in-out infinite;
}

.stream-line:nth-child(1) {
  top: 20%;
  left: 20%;
  animation-delay: 0s;
}

.stream-line:nth-child(2) {
  top: 40%;
  right: 20%;
  animation-delay: 0.5s;
}

.stream-line:nth-child(3) {
  bottom: 20%;
  left: 50%;
  animation-delay: 1s;
}

.hologram-scan {
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 10px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--neon-purple),
    transparent
  );
  animation: verticalScan 3s ease-in-out infinite;
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  animation: scrollBounce 2s ease-in-out infinite;
}

.scroll-line {
  width: 1px;
  height: 30px;
  background: var(--primary-purple);
}

.scroll-text {
  font-family: var(--font-primary);
  font-size: 0.8rem;
  letter-spacing: 0.2rem;
}

.scroll-arrow {
  font-size: 1.2rem;
  color: var(--primary-purple);
}

/* About Section */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.info-grid {
  display: grid;
  gap: 1.5rem;
}

.info-item {
  background: rgba(139, 92, 246, 0.1);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.info-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.info-item:hover::before {
  left: 100%;
}

.info-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow-purple);
}

.info-label {
  font-family: var(--font-primary);
  font-size: 0.9rem;
  color: var(--primary-purple);
  margin-bottom: 0.5rem;
}

.info-value {
  font-size: 1.2rem;
  color: var(--text-primary);
  font-weight: 600;
}

.hobbies-title {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  color: var(--primary-purple);
  margin-bottom: 2rem;
  text-align: center;
}

.hobbies-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hobby-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: rgba(139, 92, 246, 0.1);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: var(--transition-smooth);
}

.hobby-item:hover {
  transform: translateX(10px);
  box-shadow: var(--glow-purple);
}

.hobby-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-primary);
  box-shadow: var(--glow-purple);
}

.hobby-name {
  font-family: var(--font-primary);
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hobby-desc {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Skills Section */
.skills-content {
  max-width: 1000px;
  margin: 0 auto;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
  padding: 0 2rem;
}

.skill-item {
  background: rgba(139, 92, 246, 0.1);
  padding: 2.5rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-height: 200px;
}

.skill-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(139, 92, 246, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.skill-item:hover::before {
  left: 100%;
}

.skill-item:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: var(--glow-purple);
  border-color: var(--neon-purple);
}

.skill-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-primary);
  box-shadow: var(--glow-purple);
  transition: var(--transition-smooth);
  position: relative;
  z-index: 2;
}

.skill-item:hover .skill-icon {
  transform: rotateY(360deg) scale(1.1);
  box-shadow: var(--glow-neon);
}

.skill-name {
  font-family: var(--font-primary);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0;
  position: relative;
  z-index: 2;
}

.skill-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.4;
  position: relative;
  z-index: 2;
}

/* Experience Section */
.experience-content {
  max-width: 1000px;
  margin: 0 auto;
}

.experience-timeline {
  position: relative;
  padding: 2rem 0;
}

.experience-timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: -50px; /* タイムラインの最後まで線を伸ばす */
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--primary-purple),
    var(--neon-purple)
  );
  transform: translateX(-50%);
  z-index: 0; /* timeline-yearより下に配置 */
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  min-height: 80px;
  padding-top: 3rem; /* timeline-yearのスペースを確保 */
}

.timeline-item:nth-child(odd) {
  flex-direction: row;
}

.timeline-item:nth-child(even) {
  flex-direction: row-reverse;
}

.timeline-year {
  font-family: var(--font-primary);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--primary-purple);
  background: var(--bg-primary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--primary-purple);
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  z-index: 5;
  min-width: 120px;
  text-align: center;
  box-shadow: var(--glow-purple);
  /* 中央線を完全に隠すための大きな背景 */
  box-shadow: var(--glow-purple), 0 0 0 8px var(--bg-primary),
    0 0 0 10px rgba(139, 92, 246, 0.3);
}

.timeline-content {
  background: rgba(139, 92, 246, 0.1);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  flex: 1;
  max-width: 400px;
  transition: var(--transition-smooth);
  position: relative;
  z-index: 2; /* 中央線より上に配置 */
  margin-top: 1rem;
}

/* timeline-yearがないアイテムはパディングを調整 */
.timeline-item.no-year {
  padding-top: 1rem;
}

.timeline-content::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border: 15px solid transparent;
  transform: translateY(-50%);
}

.timeline-item:nth-child(odd) .timeline-content::before {
  right: -30px;
  border-left-color: rgba(139, 92, 246, 0.1);
}

.timeline-item:nth-child(even) .timeline-content::before {
  left: -30px;
  border-right-color: rgba(139, 92, 246, 0.1);
}

.timeline-content:hover {
  transform: translateY(-5px);
  box-shadow: var(--glow-purple);
}

.timeline-title {
  font-family: var(--font-primary);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.timeline-description {
  color: var(--text-secondary);
  line-height: 1.6;
  opacity: 0.8;
}

/* Projects Section */
.projects-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.project-card {
  background: rgba(139, 92, 246, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  overflow: hidden;
  transition: var(--transition-smooth);
  position: relative;
}

.project-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--glow-purple);
}

.project-image {
  position: relative;
  height: 250px;
  background: linear-gradient(45deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-placeholder {
  font-size: 4rem;
  color: var(--primary-purple);
  opacity: 0.7;
}

.project-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(139, 92, 246, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition-smooth);
}

.project-card:hover .project-overlay {
  opacity: 1;
}

.project-links {
  display: flex;
  gap: 1rem;
}

.project-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 6px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
  backdrop-filter: blur(10px);
}

.project-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.project-content {
  padding: 2rem;
}

.project-title {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.project-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-tag {
  padding: 0.3rem 0.8rem;
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary-purple);
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: var(--font-primary);
  border: 1px solid rgba(139, 92, 246, 0.5);
}

/* Contact Section */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.contact-card {
  background: rgba(139, 92, 246, 0.1);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  text-align: center;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.contact-card::before {
  content: "";
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(139, 92, 246, 0.2),
    transparent
  );
  transition: top 0.5s ease;
}

.contact-card:hover::before {
  top: 100%;
}

.contact-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--glow-purple);
}

.contact-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-primary);
  margin: 0 auto 1.5rem;
  box-shadow: var(--glow-purple);
}

.contact-title {
  font-family: var(--font-primary);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.contact-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  background: transparent;
  color: var(--primary-purple);
  text-decoration: none;
  border: 2px solid var(--primary-purple);
  border-radius: 6px;
  font-family: var(--font-primary);
  font-weight: 600;
  transition: var(--transition-smooth);
  position: relative;
  z-index: 2;
}

.contact-link:hover {
  background: var(--primary-purple);
  color: var(--text-primary);
  box-shadow: var(--glow-purple);
  transform: translateY(-2px);
}

/* Audio Controls */
.audio-controls {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(139, 92, 246, 0.1);
  padding: 1rem;
  border-radius: 50px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.audio-btn {
  width: 50px;
  height: 50px;
  background: linear-gradient(45deg, var(--primary-purple), var(--neon-purple));
  border: none;
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: var(--glow-purple);
}

.audio-btn:hover {
  transform: scale(1.1);
  box-shadow: var(--glow-neon);
}

.audio-visualizer {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 30px;
}

.visualizer-bar {
  width: 3px;
  background: var(--primary-purple);
  border-radius: 2px;
  animation: visualizerPulse 0.5s ease-in-out infinite alternate;
}

.visualizer-bar:nth-child(1) {
  animation-delay: 0s;
}
.visualizer-bar:nth-child(2) {
  animation-delay: 0.1s;
}
.visualizer-bar:nth-child(3) {
  animation-delay: 0.2s;
}
.visualizer-bar:nth-child(4) {
  animation-delay: 0.3s;
}
.visualizer-bar:nth-child(5) {
  animation-delay: 0.4s;
}

/* Cursor Effect */
.cursor-effect {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--primary-purple);
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  box-shadow: var(--glow-purple);
}

.cursor-outline {
  width: 30px;
  height: 30px;
  border: 2px solid var(--primary-purple);
  border-radius: 50%;
  position: absolute;
  transform: translate(-50%, -50%);
  transition: all 0.1s ease-out;
  opacity: 0.5;
}

/* Animations */
@keyframes cyberpulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bracketGlow {
  0%,
  100% {
    text-shadow: 0 0 5px var(--primary-purple);
  }
  50% {
    text-shadow: 0 0 20px var(--primary-purple), 0 0 30px var(--neon-purple);
  }
}

@keyframes hologramScan {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    transform: translateX(100%);
    opacity: 1;
  }
  60% {
    opacity: 0;
  }
  61% {
    transform: translateX(100%);
    opacity: 0;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translateX(-100%);
    opacity: 1;
  }
}

@keyframes underlineExpand {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

@keyframes glitch {
  0% {
    transform: translate(-50%, -50%);
  }
  20% {
    transform: translate(-52%, -48%);
  }
  40% {
    transform: translate(-48%, -52%);
  }
  60% {
    transform: translate(-52%, -48%);
  }
  80% {
    transform: translate(-48%, -52%);
  }
  100% {
    transform: translate(-50%, -50%);
  }
}

@keyframes ringRotate {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes streamFlow {
  0%,
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
  50% {
    opacity: 1;
    transform: translateY(20px);
  }
}

@keyframes verticalScan {
  0% {
    top: -100%;
  }
  50% {
    top: 50%;
  }
  100% {
    top: 100%;
  }
}

@keyframes scrollBounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-10px);
  }
}

@keyframes skillShine {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes visualizerPulse {
  0% {
    height: 5px;
  }
  100% {
    height: 25px;
  }
}

@keyframes neuralMove {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(50px) translateY(50px);
  }
}

@keyframes particleFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

@keyframes gridShift {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(50px) translateY(50px);
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .hero-container {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  * {
    max-width: 100%;
  }

  .nav-container {
    padding: 0 1rem;
    width: 100%;
    max-width: 100vw;
  }

  .nav-menu {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-logo {
    font-size: 1.2rem;
  }

  .logo-bracket,
  .logo-text {
    writing-mode: horizontal-tb;
    transform: none;
    display: inline-block;
  }

  .hero-name {
    font-size: 3rem;
  }

  .section-title {
    font-size: 2.5rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hologram-frame {
    width: 300px;
    height: 300px;
  }

  .projects-content {
    grid-template-columns: 1fr;
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    padding: 0 1rem;
  }

  /* Experience Timeline Mobile */
  .experience-timeline::before {
    left: 2rem;
    bottom: -50px; /* モバイルでも線を最後まで伸ばす */
  }

  .timeline-item {
    flex-direction: column !important;
    align-items: flex-start;
    padding-left: 4rem;
    padding-top: 4rem;
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .timeline-item.no-year {
    padding-top: 1rem;
    margin-bottom: 1rem;
  }

  .timeline-year {
    position: absolute;
    left: -3rem;
    top: 0.5rem;
    min-width: 60px;
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
    z-index: 5;
    background: var(--bg-primary);
    box-shadow: 0 0 0 8px var(--bg-primary), 0 0 0 10px rgba(139, 92, 246, 0.3);
  }

  .timeline-content {
    max-width: 100%;
    padding: 1.5rem;
  }

  .experience-section {
    padding: 5rem 1.5rem 3rem;
  }

  .timeline-content::before {
    display: none;
  }

  .skill-item {
    padding: 1.5rem 1rem;
    min-height: 180px;
  }

  .skill-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .skill-name {
    font-size: 1.1rem;
  }

  .skill-desc {
    font-size: 0.8rem;
  }

  .typing-text {
    width: 220px;
    font-size: 1rem;
    line-height: 1.5rem;
  }

  .hero-greeting {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  section {
    padding: 5rem 1rem 2rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .nav-container {
    padding: 0.8rem 1rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .nav-logo {
    font-size: 1.1rem;
  }

  .logo-bracket,
  .logo-text {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    display: inline-block;
    line-height: 1;
  }

  .hero-name {
    font-size: 2.2rem;
    line-height: 1.2;
  }

  .section-title {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  .hero-container {
    gap: 1.5rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-item {
    padding: 0.8rem;
  }

  .hologram-frame {
    width: 220px;
    height: 220px;
  }

  .sphere-inner {
    width: 120px;
    height: 120px;
  }

  .avatar-initial {
    font-size: 3rem;
  }

  .info-grid {
    gap: 1rem;
  }

  .info-item,
  .hobby-item {
    padding: 1rem;
  }

  .skill-item {
    padding: 1.5rem 1rem;
    min-height: 160px;
  }

  .project-card {
    margin: 0 0.5rem;
  }

  .project-content {
    padding: 1.5rem;
  }

  .contact-card {
    padding: 1.5rem;
  }

  .audio-controls {
    bottom: 1rem;
    right: 1rem;
    padding: 0.6rem;
    scale: 0.9;
  }

  .loading-container {
    padding: 0 1rem;
  }

  .cyber-text {
    font-size: 3rem;
  }

  /* Improve text readability on small screens */
  .project-description,
  .contact-description,
  .hobby-desc,
  .skill-desc {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .typing-text {
    width: 200px;
    font-size: 0.9rem;
    line-height: 1.4rem;
  }

  .hero-greeting {
    font-size: 0.9rem;
    height: 1.4rem;
  }

  /* Experience Timeline for very small screens */
  .timeline-item {
    padding-left: 3.5rem;
    padding-top: 3.5rem;
    margin-bottom: 1.5rem;
  }

  .timeline-item.no-year {
    padding-top: 1rem;
    margin-bottom: 1rem;
  }

  .timeline-year {
    left: -2.5rem;
    top: 0.5rem;
    min-width: 50px;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
    z-index: 5;
    background: var(--bg-primary);
    box-shadow: 0 0 0 6px var(--bg-primary), 0 0 0 8px rgba(139, 92, 246, 0.3);
  }

  .timeline-content {
    padding: 1rem;
  }
}

/* Utility Classes */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.slide-up {
  transform: translateY(50px);
  opacity: 0;
  animation: slideUp 0.8s ease-out forwards;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Loading Screen Hidden */
.loading-hidden {
  opacity: 0;
  visibility: hidden;
}

/* Smooth scrolling for older browsers */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Mobile-specific optimizations */
@media (max-width: 390px) {
  /* iPhone 14 Pro and smaller */
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  .nav-container {
    padding: 0.8rem;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .nav-logo {
    font-size: 1rem;
  }

  .logo-bracket,
  .logo-text {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    transform: none;
    display: inline-block;
    line-height: 1;
    vertical-align: baseline;
  }

  .hero-name {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  .hologram-frame {
    width: 200px;
    height: 200px;
  }

  .sphere-inner {
    width: 100px;
    height: 100px;
  }

  .avatar-initial {
    font-size: 2.5rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    padding: 0 0.5rem;
  }

  .skill-item {
    padding: 1.2rem 0.8rem;
    min-height: 150px;
  }

  .skill-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .audio-controls {
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.6rem;
  }

  .audio-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .typing-text {
    width: 180px;
    font-size: 0.85rem;
    line-height: 1.3rem;
  }

  .hero-greeting {
    font-size: 0.85rem;
    height: 1.3rem;
  }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-section {
    min-height: auto;
    padding: 4rem 2rem 2rem;
  }

  .hologram-frame {
    width: 200px;
    height: 200px;
  }

  .hero-container {
    gap: 1rem;
  }

  .hero-name {
    font-size: 2.5rem;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .cyber-text,
  .section-title,
  .hero-name {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .cyber-button {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
  }

  .nav-link {
    padding: 1rem 1.5rem;
  }

  .contact-link {
    padding: 1rem 2rem;
  }

  .project-link {
    padding: 1rem 2rem;
  }

  /* Disable hover effects on touch devices */
  .skill-item:hover,
  .project-card:hover,
  .contact-card:hover,
  .info-item:hover,
  .hobby-item:hover {
    transform: none;
    box-shadow: none;
  }

  /* But allow active states */
  .skill-item:active,
  .project-card:active,
  .contact-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
  .nav-container {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  .section-container {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  .audio-controls {
    bottom: max(2rem, env(safe-area-inset-bottom));
    right: max(2rem, env(safe-area-inset-right));
  }
}

/* Prevent zoom on form inputs on iOS */
input,
select,
textarea,
button {
  font-size: 16px;
}

/* Smooth scrolling on mobile WebKit */
* {
  -webkit-overflow-scrolling: touch;
}

/* Improve font rendering on mobile */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
