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

html,
body {
  overflow-x: hidden;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: #0f0f0f;
  color: #f5f5f5;
  line-height: 1.6;
  scroll-behavior: smooth;
}

header {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100vw;
  background:
    radial-gradient(
      circle at 20% 80%,
      rgba(255, 123, 0, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 20%,
      rgba(255, 0, 87, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(122, 0, 255, 0.1) 0%,
      transparent 50%
    ),
    linear-gradient(135deg, #121212 0%, #1c1c1c 50%, #2a2a2a 100%);
  position: relative;
  text-align: center;
  cursor: pointer;
  padding: 1rem;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(45deg, rgba(255, 123, 0, 0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 0, 87, 0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(122, 0, 255, 0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 123, 0, 0.02) 75%);
  background-size: 60px 60px;
  background-position:
    0 0,
    0 30px,
    30px -30px,
    -30px 0px;
  animation: float 20s ease-in-out infinite;
  pointer-events: none;
}

header::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(
      350px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(255, 123, 0, 0.08) 0%,
      rgba(255, 0, 87, 0.05) 40%,
      transparent 70%
    ),
    radial-gradient(
      180px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
      rgba(122, 0, 255, 0.06) 0%,
      transparent 60%
    );
  background-blend-mode: screen;
  mix-blend-mode: overlay;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  filter: blur(0.3px);
}

header:hover::after {
  opacity: 1;
}

@keyframes float {
  0%,
  100% {
    transform: translateX(0px) translateY(0px);
  }
  25% {
    transform: translateX(10px) translateY(-10px);
  }
  50% {
    transform: translateX(-5px) translateY(10px);
  }
  75% {
    transform: translateX(-10px) translateY(-5px);
  }
}

header h1 {
  font-size: clamp(2.5rem, 10vw, 5rem);
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(to right, #ff7b00, #ff0057, #7a00ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeIn 2s ease-in-out;
  margin-bottom: 1rem;
  word-wrap: break-word;
  text-align: center;
}

.typing-container {
  font-size: clamp(1.25rem, 5vw, 2.5rem);
  font-weight: 400;
  color: #ff7b00;
  display: inline-block;
  border-right: 2px solid #ff7b00;
  padding-right: 8px;
  animation: blink 0.7s step-end infinite alternate;
  letter-spacing: 1px;
  line-height: 1.4;
  min-height: clamp(1.75rem, 7vw, 3.5rem);
  vertical-align: middle;
  text-align: center;
  word-wrap: break-word;
}

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

@keyframes blink {
  0%,
  100% {
    border-color: transparent;
  }
  50% {
    border-color: #ff7b00;
  }
}

.content-area {
  background:
    radial-gradient(
      circle at 25% 25%,
      rgba(128, 128, 128, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 75% 75%,
      rgba(160, 160, 160, 0.05) 0%,
      transparent 50%
    ),
    #0f0f0f;
  position: relative;
  overflow: hidden;
}

.content-area::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(
      30deg,
      rgba(128, 128, 128, 0.02) 12%,
      transparent 12.5%,
      transparent 87%,
      rgba(128, 128, 128, 0.02) 87.5%,
      rgba(128, 128, 128, 0.02)
    ),
    linear-gradient(
      150deg,
      rgba(128, 128, 128, 0.02) 12%,
      transparent 12.5%,
      transparent 87%,
      rgba(128, 128, 128, 0.02) 87.5%,
      rgba(128, 128, 128, 0.02)
    ),
    linear-gradient(90deg, rgba(160, 160, 160, 0.01) 50%, transparent 50%);
  background-size:
    80px 80px,
    80px 80px,
    40px 40px;
  animation: drift 25s linear infinite;
  pointer-events: none;
}

@keyframes drift {
  0% {
    transform: translateX(0px) translateY(0px);
  }
  25% {
    transform: translateX(-15px) translateY(10px);
  }
  50% {
    transform: translateX(10px) translateY(-15px);
  }
  75% {
    transform: translateX(15px) translateY(5px);
  }
  100% {
    transform: translateX(0px) translateY(0px);
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 4rem 5%;
  width: 100%;
  max-width: 100vw;
}

.card {
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
  position: relative;
  z-index: 10;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.card-content {
  padding: 1.5rem;
  text-align: center;
}

.card-content h3 {
  margin-bottom: 0.8rem;
  font-size: 1.4rem;
  color: #ff7b00;
}

.card-content p {
  font-size: 1rem;
  color: #ddd;
}

footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  color: #999;
  width: 100%;
}

/* Lightbox */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    background 0.5s ease;
  z-index: 1000;
  overflow: hidden;
}

#lightbox.show {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.9);
}

#lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 0;
  transition:
    transform 0.5s ease,
    opacity 0.5s ease;
}

#lightbox img.active {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: #fff;
  cursor: pointer;
  user-select: none;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  z-index: 1001;
}

.arrow:hover {
  opacity: 1;
}

.arrow.left {
  left: 30px;
}

.arrow.right {
  right: 30px;
}

/* Clash Royale Stats Section */
#cr-stats {
  padding: 4rem 5%;
  text-align: center;
}

#cr-stats h2 {
  font-size: 2.2rem;
  color: #ff7b00;
  margin-bottom: 2rem;
}

#cr-stats h3 {
  font-size: 1.6rem;
  color: #ff7b00;
  margin: 1.5rem 0 1rem;
}

#cr-loading {
  color: #ccc;
  font-size: 1.2rem;
}

#cr-data {
  display: none;
}

#cr-data p {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

#cr-username {
  font-weight: bold;
  color: #ff7b00;
}

.trophy-display {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(
    135deg,
    #ffd700 0%,
    #ffed4e 50%,
    #ffd700 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: bold;
  font-size: 1.6rem;
}

.trophy-icon {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.3));
}

#cr-deck {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  #cr-deck {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 1rem;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.cr-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(255, 123, 0, 0.3);
}

.cr-card img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.cr-card-name {
  font-size: 0.9rem;
  color: #ddd;
  text-align: center;
  margin-bottom: 0.25rem;
}

.cr-card-level {
  font-size: 0.8rem;
  color: #ff7b00;
  text-align: center;
  font-weight: 600;
}

#cr-error {
  display: none;
  color: #ff4444;
  margin-top: 1rem;
  font-size: 1.1rem;
}

/* Japan section */
#japan-trip {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 3rem;
}

.japan-title {
  font-size: 2.5rem;
  color: #ff7b00;
  margin-bottom: 2rem;
  text-align: center;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 50;
  position: relative;
}

.japan-back-btn {
  display: block;
  margin: 1rem auto 0;
  color: #ffd700;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease 0.3s, text-shadow 0.3s ease;
  letter-spacing: 2px;
  font-weight: 300;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  animation: none;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#japan-trip.revealed .japan-back-btn {
  opacity: 1;
  pointer-events: auto;
  animation: fade-pulse 2s ease-in-out infinite;
}

.japan-back-btn:hover {
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

.japan-content-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#japan-trip .gallery {
  display: flex;
  justify-content: center;
  width: 100%;
}

#japan-trip .japan-card {
  max-width: 420px;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease 0.5s;
}

#japan-trip.revealed .japan-card {
  opacity: 1;
  pointer-events: auto;
}

#japan-trip .japan-card img {
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

/* Torii Gate Overlay */
#torii-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.8s ease, transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

#torii-overlay.zooming {
  transform: scale(3);
  opacity: 0;
  pointer-events: none;
}

#torii-overlay.hidden {
  display: none;
}

.torii-container {
  position: relative;
  width: 90%;
  max-width: 800px;
  aspect-ratio: 3264 / 2448;
}

.torii-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  height: 40%;
  background: radial-gradient(
    circle,
    rgba(255, 215, 0, 0.4) 0%,
    rgba(255, 200, 0, 0.2) 30%,
    transparent 70%
  );
  filter: blur(30px);
  animation: pulse-glow 2s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes pulse-glow {
  from {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.torii-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
  transition: filter 0.3s ease;
}

#torii-overlay:hover .torii-image {
  filter: drop-shadow(0 10px 40px rgba(255, 215, 0, 0.3));
}

.torii-hint {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffd700;
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 2px;
  animation: fade-pulse 2s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

@keyframes fade-pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}
