@import url('theme.css');

.main-dex-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: background-color 0.2s;
}

.header-area {
  position: relative;
  padding: 14px 14px 10px;
}

.header-glare {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
  pointer-events: none;
}

.mascot-lamp {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.mascot-img {
  width: 85%;
  height: 85%;
  object-fit: contain;
  filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.2));
}

.mode-indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #1f1810;
}

.title-container {
  margin-left: auto;
  text-align: right;
}

.title-zh {
  font-size: 18px;
  color: #fff8e2;
  letter-spacing: 0.3em;
  line-height: 1;
  text-shadow: 2px 2px 0 #1f1810;
}

.title-en {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #fff8e2;
  margin-top: 3px;
  letter-spacing: 0.2em;
  text-shadow: 2px 2px 0 #1f1810;
}

.content-outer {
  background: linear-gradient(180deg, #e2d9bf 0%, #c8bfa2 100%);
  border: 3px solid #1f1810;
  border-radius: 10px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.5), 0 4px 0 #1f1810;
}

.map-screen {
  background: radial-gradient(ellipse at 50% 40%, #1a3326 0%, #0a1a12 100%);
  border: 3px solid #1f1810;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 6 / 7;
  margin: 0 auto;
  max-width: 100%;
}

.dex-no {
  position: absolute;
  top: 6px;
  left: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #c7f2d0;
  letter-spacing: 0.15em;
  text-shadow: 0 0 4px rgba(199,242,208,0.6);
  z-index: 120;
}

.map-coord-display {
  position: absolute;
  top: 6px;
  right: 8px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: #c7f2d0;
  letter-spacing: 0.1em;
  text-shadow: 0 0 4px rgba(199,242,208,0.6);
  opacity: 0.8;
  z-index: 120;
}

.camera-viewfinder-overlay {
  position: absolute;
  inset: 0;
  z-index: 140;
  pointer-events: none;
}

.viewfinder-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: #ff4fa3;
}

.road-label-static {
  position: absolute;
  font-family: 'DotGothic16', sans-serif;
  font-size: 12px;
  color: rgba(199,242,208,0.5);
  text-shadow: 0 0 4px rgba(199,242,208,0.3);
  white-space: nowrap;
}

.map-stage-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transform-origin: center center;
  padding: 28px 16px;
}

.mode-info-box {
  background: #fff8e2;
  border: 2px solid #1f1810;
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.1);
  width: 45%;
}

.floor-badge-round {
  width: 80px;
  height: 80px;
  border: 4px solid #1f1810;
  border-radius: 50%;
  box-shadow: 0 4px 0 #1f1810, inset 0 2px 0 rgba(255,255,255,0.5);
  margin: -3px 0;
  color: #1f1810;
}

.floor-badge-loading::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 999px;
  background: rgba(31, 24, 16, 0.78);
}

.floor-badge-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  color: #fff;
  transform: translate(-50%, -50%);
  box-shadow: -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px;
  animation: loader-38 6s infinite;
}

.onboarding-image-wrap {
  position: relative;
  margin-top: 0.875rem;
  border-radius: 0.5rem;
  overflow: hidden;
  min-height: 160px;
  background: #1f1810;
}

.onboarding-image-wrap.is-hidden {
  display: none;
}

.onboarding-image-wrap.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(31, 24, 16, 0.78);
  z-index: 1;
}

.onboarding-image-wrap.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  color: #fff;
  transform: translate(-50%, -50%);
  box-shadow: -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px;
  animation: loader-38 6s infinite;
  z-index: 2;
}

.popup-image-wrap {
  position: relative;
  margin-top: 0.75rem;
  border-radius: 0.5rem;
  overflow: hidden;
  min-height: 160px;
  background: #1f1810;
}

.popup-image-wrap.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(31, 24, 16, 0.78);
  z-index: 1;
}

.popup-image-wrap.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  color: #fff;
  transform: translate(-50%, -50%);
  box-shadow: -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px,
              -10px -10px 0 5px;
  animation: loader-38 6s infinite;
  z-index: 2;
}

#onboarding-image {
  display: block;
  width: 100%;
  opacity: 0;
  transition: opacity 180ms ease-out;
}

#onboarding-image.is-loaded {
  opacity: 1;
}

@keyframes loader-38 {
  0% {
    box-shadow: -10px -10px 0 5px,
                -10px -10px 0 5px,
                -10px -10px 0 5px,
                -10px -10px 0 5px;
  }
  8.33% {
    box-shadow: -10px -10px 0 5px,
                10px -10px 0 5px,
                10px -10px 0 5px,
                10px -10px 0 5px;
  }
  16.66% {
    box-shadow: -10px -10px 0 5px,
                10px -10px 0 5px,
                10px 10px 0 5px,
                10px 10px 0 5px;
  }
  24.99% {
    box-shadow: -10px -10px 0 5px,
                10px -10px 0 5px,
                10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  33.32% {
    box-shadow: -10px -10px 0 5px,
                10px -10px 0 5px,
                10px 10px 0 5px,
                -10px -10px 0 5px;
  }
  41.65% {
    box-shadow: 10px -10px 0 5px,
                10px -10px 0 5px,
                10px 10px 0 5px,
                10px -10px 0 5px;
  }
  49.98% {
    box-shadow: 10px 10px 0 5px,
                10px 10px 0 5px,
                10px 10px 0 5px,
                10px 10px 0 5px;
  }
  58.31% {
    box-shadow: -10px 10px 0 5px,
                -10px 10px 0 5px,
                10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  66.64% {
    box-shadow: -10px -10px 0 5px,
                -10px -10px 0 5px,
                10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  74.97% {
    box-shadow: -10px -10px 0 5px,
                10px -10px 0 5px,
                10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  83.3% {
    box-shadow: -10px -10px 0 5px,
                10px 10px 0 5px,
                10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  91.63% {
    box-shadow: -10px -10px 0 5px,
                -10px 10px 0 5px,
                -10px 10px 0 5px,
                -10px 10px 0 5px;
  }
  100% {
    box-shadow: -10px -10px 0 5px,
                -10px -10px 0 5px,
                -10px -10px 0 5px,
                -10px -10px 0 5px;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: #0a0a0c; height: 100vh; height: 100dvh; display: flex;
  justify-content: center; align-items: center;
  font-family: 'M PLUS Rounded 1c', 'Nunito', sans-serif;
  color: var(--3ds-ink); overflow: hidden;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
textarea, input { user-select: text !important; -webkit-user-select: text !important; }

.device {
  width: 414px; height: 100vh; height: min(900px, 100dvh); position: relative;
  background: var(--3ds-bg); overflow: hidden;
  box-shadow: 0 0 0 2px #1a1a1a, 0 20px 60px rgba(0,0,0,0.65), 0 0 120px rgba(255,200,100,0.06);
}

.crt-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 50; mix-blend-mode: multiply; background: repeating-linear-gradient(transparent 0 2px, rgba(0,0,0,0.08) 2px 3px); }
.crt-overlay::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.35) 100%); pointer-events: none; }

.chi-head { font-family: 'DotGothic16', 'M PLUS Rounded 1c', sans-serif; font-weight: 700; letter-spacing: 0.06em; }

.blink { animation: blink 1s steps(2, end) infinite; }
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

@keyframes flicker { 0%, 100% { opacity: 1; } 97% { opacity: 1; } 97.5% { opacity: 0.85; } 98% { opacity: 1; } }
.crt-screen { animation: flicker 6s infinite; }

@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
.hero-bob { animation: bob 3s ease-in-out infinite; }

@keyframes scanline {
  0%   { top: -30px; }
  100% { top: 100%; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.12); } }
@keyframes fill { to { width: 100%; } }

.stack-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
#map-svg { cursor: grab; touch-action: none; transform-origin: center center; }
#map-svg:active { cursor: grabbing; }

.ripple {
  position: absolute;
  width: 40px; height: 40px;
  border: 3px solid var(--ac-yellow);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-out 0.8s ease-out forwards;
  z-index: 100;
  box-shadow: 0 0 10px var(--ac-yellow);
}
.marker {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--ac-yellow);
  border: 2px solid #1f1810;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 110;
  box-shadow: 0 0 10px var(--ac-yellow), 0 0 0 4px rgba(255, 203, 5, 0.3);
}
@keyframes ripple-out {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
@keyframes shutter {
  0% { background: #fff; opacity: 1; }
  100% { background: transparent; opacity: 0; }
}
.shutter-effect {
  position: absolute; inset: 0; z-index: 200; pointer-events: none;
  animation: shutter 0.4s ease-out forwards;
}

.dex-btn {
  background: linear-gradient(180deg, #fdfbef, #d8d1ba);
  border: 3px solid #1f1810;
  cursor: pointer;
  box-shadow: inset 0 2px 0 #fff, 0 2px 0 #1f1810;
  color: #1f1810;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  transition: transform 0.05s;
}
.dex-btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 #fff, 0 1px 0 #1f1810; }

#onboarding-dex,
#onboarding-content {
  scrollbar-width: thin;
  scrollbar-color: #ff4500 #1f1810;
}

#camera-dex,
#camera-comment {
  scrollbar-width: thin;
  scrollbar-color: #ff4fa3 #1f1810;
}

#popup-desc {
  scrollbar-width: thin;
  scrollbar-color: #2a6df4 #1f1810;
}

#camera-dex::-webkit-scrollbar,
#onboarding-dex::-webkit-scrollbar,
#popup-desc::-webkit-scrollbar,
#onboarding-content::-webkit-scrollbar,
#camera-comment::-webkit-scrollbar {
  width: 12px;
}

#camera-dex::-webkit-scrollbar-track,
#onboarding-dex::-webkit-scrollbar-track,
#popup-desc::-webkit-scrollbar-track,
#onboarding-content::-webkit-scrollbar-track,
#camera-comment::-webkit-scrollbar-track {
  background: repeating-linear-gradient(
    180deg,
    #1f1810 0 4px,
    #2b241a 4px 8px
  );
  border-left: 2px solid #0d0a08;
}

#camera-dex::-webkit-scrollbar-thumb,
#onboarding-dex::-webkit-scrollbar-thumb,
#popup-desc::-webkit-scrollbar-thumb,
#onboarding-content::-webkit-scrollbar-thumb,
#camera-comment::-webkit-scrollbar-thumb {
  background: repeating-linear-gradient(
    180deg,
    #ff7cbc 0 4px,
    #ff4fa3 4px 8px
  );
  border: 2px solid #1f1810;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 248, 226, 0.35);
}

#camera-dex::-webkit-scrollbar-thumb:hover,
#onboarding-dex::-webkit-scrollbar-thumb:hover,
#popup-desc::-webkit-scrollbar-thumb:hover,
#onboarding-content::-webkit-scrollbar-thumb:hover,
#camera-comment::-webkit-scrollbar-thumb:hover {
  background: repeating-linear-gradient(
    180deg,
    #ffa1d0 0 4px,
    #ff6ab2 4px 8px
  );
}
