:root {
  --bg-main: #05010f;
  --bg-deep: #0b0319;
  --text-main: #f8f5ff;
  --text-soft: #d8c9ff;
  --text-dim: #b59adf;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.16);
  --neon-purple: #a855f7;
  --neon-blue: #60a5fa;
  --neon-pink: #f472b6;
  --danger: #ef4444;
  --shadow-purple: 0 0 24px rgba(168, 85, 247, 0.35);
  --shadow-blue: 0 0 24px rgba(96, 165, 250, 0.20);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Orbitron", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.18), transparent 24%),
    radial-gradient(circle at 80% 30%, rgba(168, 85, 247, 0.15), transparent 20%),
    radial-gradient(circle at 65% 75%, rgba(59, 130, 246, 0.12), transparent 18%),
    linear-gradient(180deg, #080214 0%, #04010c 100%);
  overflow-x: hidden;
  position: relative;
}

.bg-layer,
.star-layer,
.glow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.star-layer::before,
.star-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.95) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,0.65) 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,255,255,0.4) 1px, transparent 1.5px);
  background-size: 180px 180px, 280px 280px, 360px 360px;
  background-position: 0 0, 70px 90px, 150px 180px;
  opacity: 0.45;
}

.glow-layer::before,
.glow-layer::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.glow-layer::before {
  width: 260px;
  height: 260px;
  left: 6%;
  top: 18%;
  background: rgba(124, 58, 237, 0.18);
}

.glow-layer::after {
  width: 340px;
  height: 340px;
  right: 8%;
  bottom: 10%;
  background: rgba(96, 165, 250, 0.10);
}

.app-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 24px 0 60px;
  position: relative;
  z-index: 1;
}

.glass-panel {
  background: rgba(17, 10, 35, 0.46);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    var(--shadow-purple),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 24px 18px;
  margin-bottom: 20px;
}

.glass-mini {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-blue);
  border-radius: 18px;
}

.logo {
  margin: 8px 0 18px;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(30px, 7vw, 68px);
  line-height: 1.2;
  color: #faf6ff;
  text-shadow:
    0 0 6px rgba(255,255,255,0.5),
    0 0 16px rgba(168, 85, 247, 0.95),
    0 0 34px rgba(168, 85, 247, 0.70);
  animation: floatLogo 4.2s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

.pixel-subtitle {
  margin: 0 0 26px;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: #d9c3ff;
  letter-spacing: 2px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.type-btn {
  border: 2px solid rgba(147, 102, 255, 0.42);
  background: rgba(123, 82, 221, 0.10);
  color: var(--text-main);
  border-radius: 999px;
  padding: 14px 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.25s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.type-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.25);
}

.type-btn.active {
  border-color: transparent;
}

.catch-section {
  position: relative;
  min-height: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;   /* 🔥 hidden → visible */
}

.loading-text {
  margin-bottom: 18px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: #d9c3ff;
  text-align: center;
  line-height: 1.7;
}

.result-flash {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,255,255,.96) 12%, rgba(196,181,253,.8) 28%, rgba(168,85,247,.2) 56%, transparent 74%);
}

.result-flash.active {
  animation: burstFlash 1s ease forwards;
}

@keyframes burstFlash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.2);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(4);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(14);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(19);
  }
}

.pokemon-reveal {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.pokemon-reveal.hidden {
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
}

.pokemon-reveal.show {
  opacity: 1;
  transform: translateY(0);
}

#pokemonImage {
  width: 230px;
  height: 230px;
  object-fit: contain;
  filter: drop-shadow(0 0 26px rgba(168, 85, 247, 0.65));
  animation: floatPokemon 3.5s ease-in-out infinite;
}

@keyframes floatPokemon {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-14px); }
}

.pokemon-info {
  margin-top: 12px;
  padding: 14px 16px;
  text-align: center;
  min-width: min(92vw, 320px);
}

.pokemon-info h2 {
  margin: 0 0 8px;
  font-size: 24px;
  text-transform: capitalize;
}

.pokemon-info p {
  margin: 4px 0;
  color: var(--text-soft);
  font-size: 13px;
}

.pokeball-wrap {
  margin-top: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pokeball-button-ui {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.save-text-mobile {
  display: none;
}

.save-text-desktop {
  display: inline;
}

.pokeball {
  position: relative;
  width: min(62vw, 390px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.40));
  overflow: visible;
}

.pokeball-top,
.pokeball-bottom {
  overflow: visible;
  will-change: transform;
}

.pokeball-top {
  transform-origin: center bottom;
}

.pokeball-bottom {
  transform-origin: center top;
}

.pokeball-top,
.pokeball-bottom,
.pokeball-middle-line,
.pokeball-center,
.pokeball-highlight {
  position: absolute;
}

.pokeball-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #ff4250 0%, #db0f21 100%);
  border: 12px solid #10172e;
  border-bottom: 10px solid #10172e;
  border-radius: 999px 999px 0 0;
  z-index: 2;
}

.pokeball-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #f8f9fb 0%, #d8dee7 100%);
  border: 12px solid #10172e;
  border-top: 10px solid #10172e;
  border-radius: 0 0 999px 999px;
  z-index: 1;
}

/* 닫혀 있을 때만 보이는 가로 검은선 */
.pokeball-middle-line {
  top: 50%;
  left: 0;
  width: 100%;
  height: 18px;
  background: #10172e;
  transform: translateY(-50%);
  z-index: 3;
  transition:
  opacity 0.18s ease,
  background 0.32s ease,
  box-shadow 0.32s ease;
}

/* 중앙 버튼을 윗뚜껑 쪽에 붙여 보이게 */
.pokeball-center {
  top: calc(50% - 4px);
  left: 50%;
  width: 86px;
  height: 86px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 4;
  background: radial-gradient(circle at 35% 35%, #cad7ff 0%, #7381ba 36%, #344071 72%, #1c2243 100%);
  border: 8px solid #10172e;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.14);
  transition: opacity 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pokeball-highlight {
  top: 16%;
  left: 16%;
  width: 28%;
  height: 14%;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  transform: rotate(-22deg);
  z-index: 3;
}

.pokeball.shake {
  animation: shakeBall 1s ease-in-out;
}

@keyframes shakeBall {
  0% { transform: rotate(0deg); }
  12% { transform: rotate(-16deg) translateX(-12px); }
  24% { transform: rotate(16deg) translateX(12px); }
  36% { transform: rotate(-13deg) translateX(-10px); }
  48% { transform: rotate(13deg) translateX(10px); }
  60% { transform: rotate(-10deg) translateX(-8px); }
  72% { transform: rotate(10deg) translateX(8px); }
  100% { transform: rotate(0deg); }
}

.pokeball.open .pokeball-middle-line {
  opacity: 0;
}

.pokeball.open .pokeball-top {
  animation: openTop 0.7s ease forwards;
}

.pokeball.open .pokeball-center {
  animation:
    moveCenterWithTop 0.7s ease forwards,
    centerRedGlow 0.45s ease-out;
}

.pokeball.open .pokeball-bottom {
  animation: openBottom 0.7s ease forwards;
}

@keyframes openTop {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-30px);
  }
}

@keyframes moveCenterWithTop {
  0% {
    transform: translate(-50%, -50%);
  }
  100% {
    transform: translate(-50%, calc(-50% - 30px));
  }
}

@keyframes openBottom {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(30px);
  }
}

.tap-text {
  margin-top: 26px;
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: rgba(228, 213, 255, 0.58);
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.dex-action-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.22s ease;
}

.primary-btn {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.35);
}

.secondary-btn {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.16);
}

.danger-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.primary-btn:hover,
.secondary-btn:hover,
.danger-btn:hover,
.dex-action-btn:hover {
  transform: translateY(-2px);
}

.manual-panel h2,
.dex-panel h2 {
  margin-top: 0;
  font-size: 22px;
}

.manual-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.manual-row input {
  flex: 1;
  min-width: 220px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  color: white;
  padding: 14px;
  font-size: 15px;
}

.manual-row input::placeholder {
  color: rgba(255,255,255,0.45);
}

.manual-help {
  margin-bottom: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.dex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dex-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.dex-card {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 0 22px rgba(124,58,237,0.18);
  border-radius: 22px;
  padding: 16px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.dex-card img {
  width: 132px;
  height: 132px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.52));
  animation: floatPokemon 4s ease-in-out infinite;
}

.dex-name {
  margin: 0 0 8px;
  text-align: center;
  font-size: 21px;
  text-transform: capitalize;
}

.dex-info {
  margin: 4px 0;
  text-align: center;
  color: #e8deff;
  font-size: 13px;
}

.nickname-input {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 14px;
  color: white;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 12px;
}

.progress-wrap {
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.10);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22d3ee, #a855f7, #f472b6);
  box-shadow: 0 0 18px rgba(168,85,247,0.45);
}

.card-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.dex-action-btn {
  flex: 1;
  color: white;
  background: rgba(255,255,255,0.09);
  border: 1px solid rgba(255,255,255,0.14);
}

.set-main-btn {
  background: linear-gradient(
    135deg,
    rgba(168, 133, 247, 0.18),
    rgba(96, 165, 250, 0.10)
  );
  border: 1px solid rgba(196, 181, 253, 0.38);
  box-shadow:
    0 0 10px rgba(168, 85, 247, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.12);
  color: #f5eeff;
}

.set-main-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(168, 133, 247, 0.28),
    rgba(96, 165, 250, 0.14)
  );
  border-color: rgba(216, 180, 254, 0.58);
  box-shadow:
    0 0 16px rgba(168, 85, 247, 0.22),
    0 0 28px rgba(96, 165, 250, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.14);
}

.delete-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
}

.delete-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.16),
    rgba(220, 38, 38, 0.12)
  );
  border-color: rgba(239, 68, 68, 0.34);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.16);
}

.main-point-btn-row {
  gap: 12px;
  margin-top: 16px;
}

.point-btn {
  position: relative;
  overflow: hidden;
  min-height: 48px;
  font-weight: 800;
  letter-spacing: 0.2px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.point-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.16),
    rgba(255,255,255,0.02)
  );
  pointer-events: none;
}

.point-plus {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.24),
    rgba(168, 85, 247, 0.18)
  );
  border: 1px solid rgba(244, 114, 182, 0.34);
  color: #fff7fb;
  box-shadow:
    0 0 14px rgba(236, 72, 153, 0.16),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.point-plus:hover {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.34),
    rgba(168, 85, 247, 0.24)
  );
  border-color: rgba(244, 114, 182, 0.56);
  box-shadow:
    0 0 18px rgba(236, 72, 153, 0.24),
    0 0 26px rgba(168, 85, 247, 0.12),
    inset 0 1px 0 rgba(255,255,255,0.16);
}

.point-minus {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.22),
    rgba(239, 68, 68, 0.18)
  );
  border: 1px solid rgba(251, 146, 60, 0.34);
  color: #fffaf5;
  box-shadow:
    0 0 14px rgba(249, 115, 22, 0.14),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.point-minus:hover {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.32),
    rgba(239, 68, 68, 0.24)
  );
  border-color: rgba(251, 146, 60, 0.52);
  box-shadow:
    0 0 18px rgba(249, 115, 22, 0.22),
    0 0 26px rgba(239, 68, 68, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.16);
}



.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  .type-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .glass-panel {
    padding: 20px 14px;
    border-radius: 22px;
  }

  .pokeball {
    width: min(72vw, 360px);
  }

  .type-btn {
    font-size: 13px;
    padding: 12px 8px;
  }

  .pokemon-info h2 {
    font-size: 20px;
  }

  .main-point-btn-row {
    gap: 10px;
  }

  .point-btn {
    min-height: 46px;
    padding: 12px 10px;
    font-size: 13px;
  }

  .set-main-btn,
  .delete-btn {
    min-height: 44px;
  }
}

.footer {
  text-align: center;
  padding: 30px 10px;
  margin-top: 50px;
  font-size: 13px;
  color: #d8c9ff;
  background: rgba(17, 10, 35, 0.4);
  border-top: 1px solid rgba(168, 85, 247, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -5px 30px rgba(168, 85, 247, 0.15);
}

.footer p {
  margin: 0;
  letter-spacing: 1px;
}

.footer-heart {
  display: inline-block;
  animation: heartbeat 1.2s infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.dex-card.evolving {
  animation: evolveGlow 1.2s ease;
}

.dex-card.evolving img {
  animation: evolveFlash 1.2s ease;
}

@keyframes evolveGlow {
  0% {
    box-shadow: 0 0 0 rgba(255,255,255,0);
  }
  20% {
    box-shadow:
      0 0 18px rgba(255,255,255,0.95),
      0 0 38px rgba(168,85,247,0.9),
      0 0 60px rgba(96,165,250,0.7);
  }
  55% {
    box-shadow:
      0 0 24px rgba(255,255,255,1),
      0 0 48px rgba(168,85,247,1),
      0 0 80px rgba(96,165,250,0.85);
  }
  100% {
    box-shadow: 0 0 22px rgba(124,58,237,0.18);
  }
}

@keyframes evolveFlash {
  0% {
    filter: brightness(1) drop-shadow(0 0 18px rgba(168,85,247,0.52));
    transform: scale(1);
  }
  25% {
    filter: brightness(2.1) drop-shadow(0 0 26px rgba(255,255,255,0.95));
    transform: scale(1.08);
  }
  55% {
    filter: brightness(2.5) drop-shadow(0 0 34px rgba(168,85,247,1));
    transform: scale(1.14);
  }
  100% {
    filter: brightness(1) drop-shadow(0 0 18px rgba(168,85,247,0.52));
    transform: scale(1);
  }
}

.student-panel h2 {
  margin-top: 0;
}

.student-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.student-row select {
  flex: 1;
  min-width: 160px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.student-row select {
  color: white;
  background: rgba(255,255,255,0.08);
}

/* 🔥 드롭다운 리스트 내부 */
.student-row select option {
  color: black;
  background: white;
}

/* 랭킹 패널 */
.ranking-panel h2 {
  margin: 0;
}

.ranking-header {
  margin-bottom: 14px;
}

.ranking-subtext {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.ranking-list {
  display: grid;
  gap: 12px;
}

.ranking-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 12px rgba(124,58,237,0.10);
}

.ranking-rank {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(168,85,247,0.22), rgba(96,165,250,0.16));
  border: 1px solid rgba(255,255,255,0.12);
}

.ranking-main h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.ranking-main p {
  margin: 0;
  font-size: 12px;
  color: #e8deff;
}

.ranking-score {
  text-align: right;
}

.ranking-score .score-number {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.ranking-score .score-label {
  font-size: 11px;
  color: var(--text-dim);
}

.ranking-empty {
  padding: 18px;
  text-align: center;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
}

@media (max-width: 620px) {
  .ranking-card {
    grid-template-columns: 40px 1fr auto;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
  }

  .ranking-rank {
    width: 40px;
    height: 40px;
    font-size: 15px;
    border-radius: 12px;
  }

  .ranking-main h3 {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .ranking-main p {
    font-size: 11px;
  }

  .ranking-score .score-number {
    font-size: 17px;
  }

  .ranking-score .score-label {
    font-size: 10px;
  }

  .ranking-subtext {
    font-size: 11px;
  }
}

.rarity {
  font-weight: bold;
  margin-top: 8px;
}

.rarity.normal {
  color: #aaa;
}

.rarity.legendary {
  color: gold;
  text-shadow: 0 0 15px gold;
}

.rarity {
  font-size: 14px;
  text-align: center;
}

.legendary-banner {
  position: absolute;
  top: 16%;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  z-index: 20;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  letter-spacing: 2px;
  white-space: nowrap;
  color: #fff3b0;
  background: linear-gradient(135deg, rgba(250,204,21,0.18), rgba(168,85,247,0.22));
  border: 1px solid rgba(250,204,21,0.45);
  box-shadow:
    0 0 18px rgba(250,204,21,0.55),
    0 0 40px rgba(168,85,247,0.35);
  opacity: 0;
  pointer-events: none;
}

.legendary-banner.show {
  animation: legendaryBannerPop 1.4s ease forwards;
}

@keyframes legendaryBannerPop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.65);
  }
  18% {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
  45% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.96);
  }
}

/* 전설일 때 화면 번쩍 강화 */
.result-flash.legendary-active {
  animation: legendaryFlashBurst 1.2s ease forwards;
  background:
    radial-gradient(circle,
      rgba(255,255,255,1) 0%,
      rgba(255,245,180,0.98) 10%,
      rgba(250,204,21,0.85) 24%,
      rgba(168,85,247,0.45) 48%,
      transparent 72%);
}

@keyframes legendaryFlashBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.2);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(6);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(20);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(24);
  }
}

/* 전설 포켓몬 카드에 금빛 glow */
.pokemon-reveal.legendary #pokemonImage {
  filter:
    drop-shadow(0 0 18px rgba(250,204,21,0.95))
    drop-shadow(0 0 34px rgba(250,204,21,0.65))
    drop-shadow(0 0 52px rgba(168,85,247,0.55));
}

.pokemon-reveal.legendary .pokemon-info {
  border-color: rgba(250,204,21,0.35);
  box-shadow:
    0 0 18px rgba(250,204,21,0.24),
    0 0 34px rgba(168,85,247,0.18);
}

.ranking-card.ranking-first {
  border: 1px solid rgba(250, 204, 21, 0.55);
  background: linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.12),
    rgba(168, 85, 247, 0.12)
  );
  box-shadow:
    0 0 18px rgba(250, 204, 21, 0.28),
    0 0 36px rgba(250, 204, 21, 0.18),
    0 0 48px rgba(168, 85, 247, 0.14);
}

.ranking-card.ranking-first .ranking-rank {
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #2b1a00;
  box-shadow:
    0 0 14px rgba(250, 204, 21, 0.45),
    0 0 28px rgba(250, 204, 21, 0.25);
}

.ranking-card.ranking-first .ranking-main h3 {
  color: #fff3b0;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.45);
}

.ranking-card.ranking-first .score-number {
  color: #facc15;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.4);
}

.dex-card.rewarded {
  animation: rewardGlow 1.4s ease;
}

.dex-card.rewarded img {
  animation: rewardPop 1.4s ease;
}

@keyframes rewardGlow {
  0% {
    box-shadow: 0 0 0 rgba(255,255,255,0);
    transform: scale(1);
  }
  20% {
    box-shadow:
      0 0 16px rgba(255,255,255,0.95),
      0 0 30px rgba(34,197,94,0.85),
      0 0 54px rgba(16,185,129,0.6);
    transform: scale(1.02);
  }
  55% {
    box-shadow:
      0 0 24px rgba(255,255,255,1),
      0 0 42px rgba(34,197,94,0.95),
      0 0 70px rgba(16,185,129,0.7);
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 22px rgba(124,58,237,0.18);
    transform: scale(1);
  }
}

@keyframes rewardPop {
  0% {
    transform: scale(0.85);
    filter: brightness(1) drop-shadow(0 0 18px rgba(168,85,247,0.52));
  }
  30% {
    transform: scale(1.12);
    filter: brightness(1.8) drop-shadow(0 0 24px rgba(34,197,94,0.95));
  }
  60% {
    transform: scale(1.06);
    filter: brightness(1.5) drop-shadow(0 0 30px rgba(16,185,129,0.9));
  }
  100% {
    transform: scale(1);
    filter: brightness(1) drop-shadow(0 0 18px rgba(168,85,247,0.52));
  }
}

.legendary-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(250, 204, 21, 0.42);

  background:
    linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03)),
    linear-gradient(120deg,
      rgba(250,204,21,0.18) 0%,
      rgba(168,85,247,0.18) 35%,
      rgba(34,211,238,0.16) 70%,
      rgba(255,255,255,0.08) 100%
    );

  box-shadow:
    0 0 18px rgba(250, 204, 21, 0.18),
    0 0 34px rgba(168, 85, 247, 0.14),
    0 0 54px rgba(34, 211, 238, 0.10);

  animation: legendaryCardGlow 4.5s ease-in-out infinite;
}

.legendary-card::before {
  content: "";
  position: absolute;
  inset: -25%;
  border-radius: inherit;
  pointer-events: none;

  background: linear-gradient(
    115deg,
    transparent 12%,
    rgba(255,255,255,0.00) 22%,
    rgba(255,255,255,0.08) 30%,
    rgba(250,204,21,0.18) 40%,
    rgba(255,255,255,0.15) 48%,
    rgba(34,211,238,0.16) 58%,
    rgba(168,85,247,0.14) 68%,
    rgba(255,255,255,0.00) 78%,
    transparent 88%
  );

  mix-blend-mode: screen;
  filter: blur(2px);
  opacity: 0.95;

  animation: legendaryPrismSweep 5.6s ease-in-out infinite;
}

.legendary-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;

  background:
    radial-gradient(circle at 18% 22%, rgba(255,255,255,0.12), transparent 24%),
    radial-gradient(circle at 84% 28%, rgba(250,204,21,0.14), transparent 28%),
    radial-gradient(circle at 52% 82%, rgba(34,211,238,0.10), transparent 24%),
    linear-gradient(
      180deg,
      rgba(255,255,255,0.04),
      transparent 22%,
      transparent 78%,
      rgba(255,255,255,0.05)
    );
}


@keyframes luxuryPrismSweep {
  0% {
    transform: translateX(-120%) rotate(9deg);
    opacity: 0;
  }
  10% {
    opacity: 0.55;
  }
  45% {
    opacity: 0.95;
  }
  70% {
    opacity: 0.65;
  }
  100% {
    transform: translateX(120%) rotate(9deg);
    opacity: 0;
  }
}

.legendary-badge-card {
  width: 100%;
  text-align: center;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;

  color: #fff7cc;

  background:
    linear-gradient(135deg,
      rgba(250,204,21,0.18),
      rgba(168,85,247,0.12),
      rgba(34,211,238,0.10));

  border: 1px solid rgba(250,204,21,0.45);

  position: relative;
  overflow: hidden;

  text-shadow:
    0 0 6px rgba(250,204,21,0.3),
    0 0 10px rgba(255,255,255,0.15);

  /* 🔥 핵심: 천천히 빛나는 효과 */
  animation: legendaryGlowPulse 3.2s ease-in-out infinite;
}

.legendary-card::before {
  content: "";
  position: absolute;
  inset: -35%;
  pointer-events: none;
  border-radius: inherit;

  background: linear-gradient(
    115deg,
    transparent 18%,
    rgba(255, 255, 255, 0.00) 28%,
    rgba(255, 255, 255, 0.06) 36%,
    rgba(250, 204, 21, 0.10) 44%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(34, 211, 238, 0.08) 58%,
    rgba(168, 85, 247, 0.07) 66%,
    rgba(255, 255, 255, 0.00) 74%,
    transparent 84%
  );

  transform: translateX(-130%) rotate(10deg);
  animation: luxuryPrismSweep 6.8s ease-in-out infinite;
  mix-blend-mode: screen;
  opacity: 0.75;
  filter: blur(3px);
}

.legendary-badge-card {
  animation:
    legendaryGlowPulse 3.2s ease-in-out infinite,
    legendaryTextGlow 3.2s ease-in-out infinite;
}

@keyframes legendaryTextGlow {
  0%, 100% {
    text-shadow:
      0 0 6px rgba(250,204,21,0.25),
      0 0 10px rgba(255,255,255,0.1);
  }

  50% {
    text-shadow:
      0 0 12px rgba(250,204,21,0.6),
      0 0 18px rgba(255,255,255,0.25);
  }
}

@keyframes centerRedGlow {
  0% {
    background: radial-gradient(circle at 35% 35%, #cad7ff 0%, #7381ba 36%, #344071 72%, #1c2243 100%);
    box-shadow: 0 0 0 6px rgba(255,255,255,0.14);
  }
  40% {
    background: radial-gradient(circle at 35% 35%, #ffb3b3 0%, #ff4d4d 34%, #b91c1c 70%, #4a0f0f 100%);
    box-shadow:
      0 0 0 6px rgba(255,255,255,0.14),
      0 0 18px rgba(255, 77, 77, 0.75),
      0 0 32px rgba(255, 77, 77, 0.45);
  }
  100% {
    background: radial-gradient(circle at 35% 35%, #cad7ff 0%, #7381ba 36%, #344071 72%, #1c2243 100%);
    box-shadow: 0 0 0 6px rgba(255,255,255,0.14);
  }
}

.pokeball-stars {
  position: absolute;
  z-index: 8;
  font-size: 36px; /* 🔥 더 크게 */
  color: #fff6b0;
  text-shadow:
    0 0 10px rgba(255,255,255,0.9),
    0 0 18px rgba(250,204,21,0.7);
  opacity: 0;
  pointer-events: none;
}

/* 🔥 둘 다 위쪽에 배치 + 높이 차이 */
.star-1 {
  top: 10%;
  left: 22%;
}

.star-2 {
  top: 4%;
  right: 20%;
}

.pokeball.open .star-1 {
  animation: starBurstLeft 0.7s ease-out forwards;
}

.pokeball.open .star-2 {
  animation: starBurstRight 0.7s ease-out forwards;
}

@keyframes starBurstLeft {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3);
  }
  30% {
    opacity: 1;
    transform: translate(-6px, -10px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-18px, -24px) scale(1.5);
  }
}

@keyframes starBurstRight {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3);
  }
  30% {
    opacity: 1;
    transform: translate(6px, -12px) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(18px, -26px) scale(1.5);
  }
}

.pokeball-stars {
  animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hero {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding-left: 0;
  padding-right: 0;
}

.hero .catch-section {
  background: transparent;
}

.hero .pokemon-info {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.legendary-card .dex-name {
  color: #fff3b0;
  text-shadow:
    0 0 8px rgba(250, 204, 21, 0.28),
    0 0 16px rgba(255,255,255,0.10);
}

.legendary-card img {
  filter:
    drop-shadow(0 0 14px rgba(250, 204, 21, 0.55))
    drop-shadow(0 0 24px rgba(168, 85, 247, 0.26))
    drop-shadow(0 0 34px rgba(34, 211, 238, 0.16));
}

.legendary-card .dex-info {
  color: #f5ecff;
}

.legendary-card .progress-fill {
  background: linear-gradient(90deg, #facc15, #a855f7, #22d3ee);
  box-shadow:
    0 0 12px rgba(250,204,21,0.26),
    0 0 18px rgba(168,85,247,0.20);
}

@keyframes legendaryCardGlow {
  0%, 100% {
    box-shadow:
      0 0 16px rgba(250, 204, 21, 0.16),
      0 0 28px rgba(168, 85, 247, 0.12),
      0 0 44px rgba(34, 211, 238, 0.08);
  }

  50% {
    box-shadow:
      0 0 24px rgba(250, 204, 21, 0.26),
      0 0 40px rgba(168, 85, 247, 0.18),
      0 0 62px rgba(34, 211, 238, 0.12);
  }
}

@keyframes legendaryPrismSweep {
  0% {
    transform: translateX(-115%) rotate(9deg);
    opacity: 0;
  }

  14% {
    opacity: 0.55;
  }

  45% {
    opacity: 1;
  }

  70% {
    opacity: 0.65;
  }

  100% {
    transform: translateX(115%) rotate(9deg);
    opacity: 0;
  }
}

.raid-entry-panel {
  text-align: center;
}

.raid-entry-panel h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 22px;
}

.raid-entry-text {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 14px;
}

.raid-entry-btn {
  width: 100%;
  max-width: 320px;
}

.main-pokemon-panel h2 {
  margin: 0;
  font-size: 22px;
}

.main-pokemon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.main-pokemon-box {
  min-height: 220px;
  border-radius: 22px;
  padding: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 18px rgba(124,58,237,0.12);
}

.main-pokemon-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}


.main-pokemon-name {
  margin: 0 0 8px;
  font-size: 24px;
  text-transform: capitalize;
}

.main-pokemon-info {
  margin: 4px 0;
  color: #e8deff;
  font-size: 14px;
}

.dex-count-text {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.main-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  box-shadow:
    0 0 16px rgba(168, 85, 247, 0.35),
    0 0 28px rgba(99, 102, 241, 0.18);
}

.type-badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0 4px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow:
    0 0 12px rgba(255,255,255,0.10),
    inset 0 1px 0 rgba(255,255,255,0.22);
}

.legendary-corner-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #facc15, #f59e0b, #fde68a);
  color: #2b1a00;
  border: 1px solid rgba(255,255,255,0.38);
  box-shadow:
    0 0 18px rgba(250,204,21,0.38),
    0 0 28px rgba(250,204,21,0.18);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.legendary-corner-icon {
  font-size: 12px;
  line-height: 1;
}

.legendary-corner-text {
  line-height: 1;
}

.main-pokemon-card.evolving {
  animation: evolveGlow 1.2s ease;
}

.main-pokemon-card.evolving img {
  animation: evolveFlash 1.2s ease;
}

.dex-card:hover img {
  filter: drop-shadow(0 0 22px rgba(168, 85, 247, 0.68));
}

.dex-card.legendary-card:hover img {
  filter:
    drop-shadow(0 0 16px rgba(250, 204, 21, 0.82))
    drop-shadow(0 0 28px rgba(250, 204, 21, 0.48))
    drop-shadow(0 0 38px rgba(168, 85, 247, 0.18));
}

.dex-card {
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 1, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.app-modal-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  padding: 24px 18px 18px;
  border-radius: 24px;
  background: rgba(17, 10, 35, 0.94);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 0 24px rgba(168, 85, 247, 0.28),
    0 0 48px rgba(96, 165, 250, 0.12);
}

.app-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  background: rgba(255,255,255,0.08);
  color: white;
}

.app-modal-eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 1.6px;
  color: #d8c9ff;
  text-transform: uppercase;
}

.app-modal-title {
  margin: 0 0 10px;
  font-size: 22px;
}

.app-modal-message {
  margin: 0 0 16px;
  color: #e8deff;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

.app-modal-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 420px;
  overflow-y: auto;
}

.modal-pokemon-option {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
}

.modal-pokemon-option img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.modal-pokemon-text strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.modal-pokemon-text span {
  display: block;
  font-size: 12px;
  color: #d8c9ff;
}

.modal-select-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
}

.app-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-action-btn {
  flex: 1;
  min-width: 120px;
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}

.modal-action-btn.primary {
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: white;
}

.modal-action-btn.secondary {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.14);
}

.modal-action-btn.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  z-index: 1000;
  width: min(90vw, 420px);
  padding: 14px 16px;
  border-radius: 14px;
  text-align: center;
  background: rgba(17, 10, 35, 0.96);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 0 18px rgba(168,85,247,0.28);
  color: white;

  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.app-toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast.toast-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

@media (max-width: 520px) {
  .app-modal-panel {
    width: min(94vw, 460px);
    padding: 22px 14px 14px;
    border-radius: 20px;
  }

  .modal-pokemon-option {
    grid-template-columns: 52px 1fr;
  }

  .modal-select-btn {
    grid-column: 1 / -1;
  }
}

.sound-switch {
  --switch-off: #7c7c7c;
  --switch-on: #8b5cf6;
  --switch-text-off: #6f6f6f;
  --switch-text-on: #ffffff;

  position: relative;
  display: inline-block;
  width: 108px;
  height: 42px;
  cursor: pointer;
  user-select: none;
}

.hero-actions .sound-switch {
  margin-top: 2px;
}

.sound-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sound-switch-track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 3px solid var(--switch-off);
  transition:
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
  overflow: hidden;
}

.sound-switch-thumb {
  position: absolute;
  top: 50%;
  left: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--switch-off);
  transform: translateY(-50%);
  transition:
    left 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.20s ease,
    border-radius 0.20s ease,
    background 0.35s ease,
    box-shadow 0.35s ease;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}

.sound-switch-text {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition:
    opacity 0.22s ease,
    color 0.35s ease,
    transform 0.25s ease;
  pointer-events: none;
}

.sound-switch-text.off {
  right: 10px;
  color: var(--switch-text-off);
  opacity: 1;
}

.sound-switch-text.on {
  left: 12px;
  color: var(--switch-text-on);
  opacity: 0;
}

/* 눌렀을 때 살짝 눌리는 느낌 */
.sound-switch:active .sound-switch-thumb {
  width: 31px;
}

/* ON 상태 */
.sound-switch input:checked + .sound-switch-track {
  border-color: var(--switch-on);
  background: rgba(139, 92, 246, 0.10);
  box-shadow:
    0 0 14px rgba(139, 92, 246, 0.18),
    0 0 28px rgba(139, 92, 246, 0.10);
}

.sound-switch input:checked + .sound-switch-track .sound-switch-thumb {
  left: calc(100% - 29px);
  background: var(--switch-on);
  box-shadow:
    0 0 12px rgba(139, 92, 246, 0.35),
    0 0 20px rgba(139, 92, 246, 0.18);
}

/* OFF/ON 텍스트 전환 */
.sound-switch input:checked + .sound-switch-track .sound-switch-text.off {
  opacity: 0;
  transform: translateY(-50%) translateX(6px);
}

.sound-switch input:checked + .sound-switch-track .sound-switch-text.on {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* thumb가 닿을 때 살짝 펴지는 느낌 */
.sound-switch input:checked + .sound-switch-track .sound-switch-thumb {
  animation: switchThumbStretch 0.42s ease;
}

@keyframes switchThumbStretch {
  0% {
    width: 26px;
    border-radius: 50%;
  }
  45% {
    width: 34px;
    border-radius: 16px;
  }
  100% {
    width: 26px;
    border-radius: 50%;
  }
}

.class-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.class-panel-header h2 {
  margin: 0;
  font-size: 22px;
}

.class-panel-subtext {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.class-list {
  display: grid;
  gap: 12px;
}

.class-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 12px rgba(124,58,237,0.10);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.class-card:hover {
  transform: translateY(-2px);
  border-color: rgba(196,181,253,0.30);
  box-shadow:
    0 0 16px rgba(168,85,247,0.16),
    0 0 26px rgba(96,165,250,0.08);
}

.class-card-main h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.class-card-main p {
  margin: 0;
  font-size: 12px;
  color: #e8deff;
}

.class-card-arrow {
  font-size: 18px;
  color: #d8c9ff;
}

.class-empty {
  padding: 18px;
  text-align: center;
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
}

@media (max-width: 520px) {
  .class-card {
    grid-template-columns: 1fr;
  }

  .class-card-arrow {
    display: none;
  }
}

.modal-class-group {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.modal-class-group:last-child {
  margin-bottom: 0;
}

.modal-class-group-title {
  font-size: 12px;
  letter-spacing: 1.2px;
  color: #d8c9ff;
  text-transform: uppercase;
}

.modal-class-student-list {
  display: grid;
  gap: 10px;
}

.save-student-group {
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.save-student-group:last-child {
  margin-bottom: 0;
}

.save-student-group-head {
  margin-bottom: 12px;
}

.save-student-group-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #f5eeff;
  background: linear-gradient(135deg, rgba(168,85,247,0.28), rgba(99,102,241,0.20));
  border: 1px solid rgba(196,181,253,0.28);
}

.save-student-group-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.save-student-group-meta {
  margin: 0;
  font-size: 12px;
  color: #d8c9ff;
}

.save-student-grid {
  display: grid;
  gap: 10px;
}

.save-student-card {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  color: white;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 0 12px rgba(124,58,237,0.10);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.save-student-card:hover {
  transform: translateY(-2px);
  border-color: rgba(196,181,253,0.30);
  box-shadow:
    0 0 16px rgba(168,85,247,0.16),
    0 0 26px rgba(96,165,250,0.08);
  background: rgba(255,255,255,0.08);
}

.save-student-card-main strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.save-student-card-main span {
  display: block;
  font-size: 12px;
  color: #d8c9ff;
}

.save-student-card-arrow {
  font-size: 18px;
  color: #d8c9ff;
}

@media (max-width: 520px) {
  .save-student-group {
    padding: 12px;
    border-radius: 18px;
  }

  .save-student-card {
    padding: 13px 14px;
  }

  .save-student-group-title {
    font-size: 17px;
  }
}

/* ===== Mobile UX Optimization ===== */

html {
  -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea,
button {
  font-size: 16px;
}

button,
select,
input,
label,
.student-accordion-head,
.class-card,
.raid-player-banner,
.participant-card,
.save-student-card {
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;

    .save-text-desktop {
    display: none;
    }

    .save-text-mobile {
    display: inline;
    }

  }

  .glass-panel {
    padding: 18px 14px;
    border-radius: 22px;
    margin-bottom: 14px;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .dex-action-btn,
  .modal-action-btn,
  .modal-select-btn {
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
  }

  .type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .type-btn {
  min-height: 42px;
  padding: 10px 6px;
  font-size: 12px;
  border-radius: 12px;
}

  .hero-actions {
    width: 100%;
    gap: 10px;
  }

  .hero-actions .primary-btn,
  .hero-actions .sound-switch {
    width: 100%;
  }

  .class-card {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .class-card-main h3 {
    font-size: 16px;
  }

  .ranking-card {
    padding: 10px 12px;
    border-radius: 16px;
  }

  .manual-row,
  .student-manual-row {
    flex-direction: column;
  }

  .manual-row input,
  .student-manual-row input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
  }

  .manual-row button,
  .student-manual-row button {
    width: 100%;
  }

  .dex-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-pokemon-option {
    border-radius: 16px;
    padding: 12px;
  }

  .app-modal-panel {
    width: min(95vw, 460px);
    padding: 22px 14px 14px;
    border-radius: 20px;
  }

  .app-modal-actions {
    flex-direction: column;
  }

  .app-modal-actions .modal-action-btn {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .logo {
    font-size: clamp(28px, 10vw, 40px);
  }

  .pixel-subtitle {
    font-size: 11px;
    margin-bottom: 18px;
  }

  .catch-section {
    min-height: auto;
  }

  #pokemonImage {
    width: 180px;
    height: 180px;
  }

  .pokemon-info {
    min-width: 100%;
    width: 100%;
    padding: 14px 12px;
  }

  .pokeball {
    width: min(74vw, 320px);
  }

  .pokeball,
.pokeball-top,
.pokeball-bottom,
.pokeball-center,
.legendary-ball-aura,
.legendary-ball-shine {
  transition:
    background 0.42s ease,
    border-color 0.42s ease,
    box-shadow 0.42s ease,
    opacity 0.42s ease,
    filter 0.42s ease,
    transform 0.42s ease;
}

  .tap-text {
    font-size: 10px;
    margin-top: 18px;
  }

  .class-panel-header,
  .ranking-header,
  .dex-header,
  .main-pokemon-header {
    gap: 10px;
  }

  .class-panel-header .primary-btn,
  .raid-entry-btn,
  .dex-header .danger-btn {
    width: 100%;
  }

  .save-student-card,
  .participant-card,
  .raid-player-banner {
    min-height: 72px;
  }

  .participant-name,
  .raid-player-name {
    font-size: 15px;
  }

  .participant-subtext,
  .raid-player-damage,
  .save-student-card-main span {
    font-size: 11px;
  }

  .participant-pokemon-preview,
  .student-avatar,
  .student-avatar-empty {
    width: 58px;
    height: 58px;
  }

  .participant-pokemon-preview img,
  .student-storage-card img {
    width: 50px;
    height: 50px;
  }

  .footer {
    padding: 22px 10px;
    font-size: 12px;
  }
}

/* 터치 피드백 */
@media (hover: none) and (pointer: coarse) {
  .primary-btn:active,
  .secondary-btn:active,
  .danger-btn:active,
  .dex-action-btn:active,
  .type-btn:active,
  .class-card:active,
  .student-accordion-head:active,
  .participant-card:active,
  .raid-player-banner:active,
  .save-student-card:active {
    transform: scale(0.98);
    opacity: 0.92;
  }

  .class-card:hover,
  .student-accordion-card:hover,
  .student-storage-card:hover,
  .participant-card:hover,
  .raid-player-banner:hover,
  .save-student-card:hover,
  .type-btn:hover {
    transform: none;
    box-shadow: inherit;
  }
}

.icon-back-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
}

.class-topbar .icon-back-btn,
.raid-topbar .icon-back-btn {
  width: 46px;
  min-width: 46px;
  flex: 0 0 46px;
}

@media (max-width: 780px) {
  .class-topbar .icon-back-btn,
  .raid-topbar .icon-back-btn {
    width: 46px !important;
  }
}

.modal-input-wrap {
  display: grid;
  gap: 10px;
}

.modal-text-input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: white;
  font-size: 15px;
  outline: none;
}

.modal-text-input::placeholder {
  color: rgba(255,255,255,0.45);
}

.modal-text-input:focus {
  border-color: rgba(196,181,253,0.55);
  box-shadow:
    0 0 0 3px rgba(168,85,247,0.12),
    0 0 14px rgba(168,85,247,0.18);
}

.modal-student-search-wrap {
  margin-bottom: 12px;
}

.modal-text-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 14px;
}

.modal-text-input::placeholder {
  color: rgba(255,255,255,0.45);
}

.modal-student-group {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-student-group-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.modal-student-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.modal-student-btn {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: white;
  cursor: pointer;
}

.modal-student-btn strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.modal-student-btn span {
  font-size: 12px;
  color: #d8c9ff;
}

.modal-student-empty {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: #d8c9ff;
  font-size: 13px;
}

@media (max-width: 520px) {
  .modal-student-grid {
    grid-template-columns: 1fr;
  }
}

.catch-student-panel {
  width: min(92vw, 520px);
  margin-top: 18px;
  padding: 14px;
  border-radius: 18px;
}

.catch-student-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.catch-student-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.catch-student-field label {
  font-size: 12px;
  color: #d8c9ff;
  letter-spacing: 0.6px;
}

.catch-student-field select {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 14px;
}

.catch-student-field select option {
  color: black;
  background: white;
}

.catch-student-status {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

@media (max-width: 520px) {
  .catch-student-row {
    grid-template-columns: 1fr;
  }

  .catch-student-panel {
    width: 100%;
    padding: 12px;
    margin-top: 16px;
  }
}

/* ===== Legendary Mode Deluxe ===== */

.legendary-banner {
  font-size: 18px;
  letter-spacing: 2.6px;
  padding: 16px 26px;
  color: #fff7cc;
  background:
    linear-gradient(135deg,
      rgba(250,204,21,0.22),
      rgba(168,85,247,0.20),
      rgba(255,255,255,0.08));
  border: 1px solid rgba(250,204,21,0.55);
  box-shadow:
    0 0 22px rgba(250,204,21,0.42),
    0 0 46px rgba(168,85,247,0.28);
}

.legendary-banner.show {
  animation: legendaryBannerPopDeluxe 1.55s ease forwards;
}

@keyframes legendaryBannerPopDeluxe {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.55) translateY(8px);
    filter: blur(6px);
  }
  18% {
    opacity: 1;
    transform: translateX(-50%) scale(1.12) translateY(0);
    filter: blur(0);
  }
  48% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.95) translateY(-6px);
  }
}

.legendary-screen-flash {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 45%,
      rgba(255,255,255,0.95) 0%,
      rgba(255,245,180,0.55) 18%,
      rgba(250,204,21,0.22) 34%,
      rgba(168,85,247,0.10) 55%,
      rgba(255,255,255,0) 76%);
}

.legendary-screen-flash.active {
  animation: legendaryScreenFlashBurst 0.9s ease forwards;
}

@keyframes legendaryScreenFlashBurst {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  18% {
    opacity: 1;
    transform: scale(1.02);
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.pokeball.legendary-mode {
  filter:
    drop-shadow(0 0 24px rgba(250,204,21,0.62))
    drop-shadow(0 0 48px rgba(168,85,247,0.36))
    drop-shadow(0 0 74px rgba(255,255,255,0.16));
}

.pokeball.legendary-mode .pokeball-top {
  background:
    linear-gradient(180deg, #8b5cf6 0%, #6d28d9 42%, #ec4899 100%);
  border-color: #191233;
  box-shadow:
    0 0 20px rgba(168,85,247,0.24),
    inset 0 0 18px rgba(255,255,255,0.08);
}

.pokeball.legendary-mode .pokeball-bottom {
  background:
    linear-gradient(180deg, #fffaf0 0%, #f3e8ff 55%, #ddd6fe 100%);
  border-color: #191233;
}

.pokeball.legendary-mode .pokeball-middle-line {
  background:
    linear-gradient(90deg,
      rgba(250,204,21,0.95),
      rgba(255,255,255,1),
      rgba(250,204,21,0.95));
  box-shadow:
    0 0 16px rgba(250,204,21,0.45),
    0 0 28px rgba(255,255,255,0.18);
}

.pokeball.legendary-mode .pokeball-center {
  background:
    radial-gradient(circle at 35% 35%,
      #fff7cc 0%,
      #facc15 24%,
      #c084fc 58%,
      #4c1d95 100%);
  border-color: #1a1235;
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.14),
    0 0 20px rgba(250,204,21,0.56),
    0 0 40px rgba(168,85,247,0.34);
}

.pokeball.legendary-mode .pokeball-highlight {
  background: rgba(255,255,255,0.36);
}

.legendary-ball-aura,
.legendary-ball-ring,
.legendary-ball-shine,
.legendary-ball-emblem {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.legendary-ball-aura {
  inset: -12%;
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(250,204,21,0.28) 0%,
      rgba(250,204,21,0.18) 24%,
      rgba(168,85,247,0.12) 48%,
      rgba(255,255,255,0) 74%);
  filter: blur(12px);
  z-index: 0;
}

.legendary-ball-ring {
  inset: 5%;
  border-radius: 50%;
  border: 2px solid rgba(250,204,21,0.6);
  box-shadow:
    0 0 16px rgba(250,204,21,0.30),
    0 0 34px rgba(168,85,247,0.18);
  z-index: 5;
}

.legendary-ball-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  z-index: 6;
  opacity: 0;
}

.legendary-ball-shine::before {
  content: "";
  position: absolute;
  inset: -22%;
  border-radius: 50%;
  background: linear-gradient(
    125deg,
    transparent 18%,
    rgba(255,255,255,0.00) 32%,
    rgba(255,255,255,0.10) 40%,
    rgba(255,255,255,0.32) 48%,
    rgba(250,204,21,0.16) 54%,
    rgba(255,255,255,0.08) 60%,
    rgba(255,255,255,0.00) 70%,
    transparent 82%
  );
  transform: translateX(-115%) rotate(18deg);
  filter: blur(2px);
  opacity: 0.95;
}

.pokeball.legendary-mode .legendary-ball-shine {
  opacity: 1;
}

.pokeball.legendary-mode .legendary-ball-shine::before {
  animation: shineFlowArc 2.6s ease-in-out infinite;
}

@keyframes shineFlowArc {
  0% {
    transform: translateX(-115%) rotate(18deg);
    opacity: 0;
  }
  12% { opacity: 0.55; }
  42% { opacity: 1; }
  72% { opacity: 0.62; }
  100% {
    transform: translateX(115%) rotate(18deg);
    opacity: 0;
  }
}

.legendary-ball-emblem {
  top: 17%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  color: #fff7cc;
  text-shadow:
    0 0 8px rgba(250,204,21,0.55),
    0 0 16px rgba(255,255,255,0.22);
}

.pokeball.legendary-mode .legendary-ball-aura {
  opacity: 1;
  animation: legendaryAuraPulse 2.1s ease-in-out infinite;
}

.pokeball.legendary-mode .legendary-ball-ring {
  opacity: 1;
  animation: legendaryRingPulse 2.3s ease-in-out infinite;
}


.pokeball.legendary-mode .legendary-ball-emblem {
  opacity: 1;
  animation: legendaryEmblemPulse 1.8s ease-in-out infinite;
}

@keyframes legendaryAuraPulse {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes legendaryRingPulse {
  0%, 100% {
    transform: scale(0.97);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.95;
  }
}


@keyframes legendaryEmblemPulse {
  0%, 100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.85;
  }
  50% {
    transform: translateX(-50%) scale(1.08);
    opacity: 1;
  }
}

.tap-text.legendary-ready {
  color: #fff3b0;
  text-shadow:
    0 0 10px rgba(250,204,21,0.44),
    0 0 22px rgba(168,85,247,0.24);
}

.primary-btn.disabled-save {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.15);
}

/* 레전더리 변환 전용 라이트 스윕 */
.pokeball::before {
  background: linear-gradient(
  120deg,
  transparent 24%,
  rgba(255,255,255,0.00) 36%,
  rgba(255,255,255,0.18) 46%,
  rgba(255,255,255,0.00) 58%,
  transparent 72%
);

inset: -8%;
filter: blur(1px);
}

.pokeball.legendary-mode::before {
  animation: ballLightSweep 0.8s ease forwards;
}

@keyframes ballLightSweep {
  0% {
    transform: translateX(-120%) rotate(20deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateX(120%) rotate(20deg);
    opacity: 0;
  }
}

.pokeball.legendary-exit {
  transition: filter 0.4s ease, box-shadow 0.4s ease;
  filter: brightness(1.2);
}

.pokeball.legendary-mode {
  transition: all 0.5s ease;
}

.pokeball-top,
.pokeball-bottom,
.pokeball-middle-line,
.pokeball-center,
.pokeball-highlight,
.legendary-ball-aura,
.legendary-ball-shine,
.legendary-ball-emblem {
  transition:
    background 0.36s ease,
    border-color 0.36s ease,
    box-shadow 0.36s ease,
    opacity 0.3s ease,
    filter 0.3s ease,
    transform 0.4s ease;
}

.pokeball.legendary-revert {
  filter:
    drop-shadow(0 0 14px rgba(250,204,21,0.18))
    drop-shadow(0 0 22px rgba(168,85,247,0.12));
}

/* ===== Guide Info Button ===== */

.hero-topbar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 4px;
}

.hero-topbar-spacer {
  min-height: 1px;
}

.guide-info-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;

  background: linear-gradient(
    135deg,
    rgba(196, 181, 253, 0.18),
    rgba(168, 85, 247, 0.22)
  );
  border: 1px solid rgba(196, 181, 253, 0.42);

  box-shadow:
    0 0 10px rgba(168, 85, 247, 0.20),
    0 0 18px rgba(96, 165, 250, 0.08),
    inset 0 1px 0 rgba(255,255,255,0.12);

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.guide-info-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 180, 254, 0.62);
  box-shadow:
    0 0 14px rgba(168, 85, 247, 0.28),
    0 0 24px rgba(96, 165, 250, 0.10),
    inset 0 1px 0 rgba(255,255,255,0.16);
}

.guide-info-btn:active {
  transform: scale(0.96);
}

.guide-info-icon {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  color: #d8b4fe;
  text-shadow:
    0 0 8px rgba(216, 180, 254, 0.45),
    0 0 14px rgba(168, 85, 247, 0.22);
}

/* ===== Guide Modal Content ===== */

.guide-modal-list {
  display: grid;
  gap: 14px;
}

.guide-language-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.guide-lang-btn {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #e9ddff;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.guide-lang-btn.active {
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.22),
    rgba(99, 102, 241, 0.18)
  );
  border-color: rgba(196, 181, 253, 0.36);
  color: #fff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.18);
}

.guide-content {
  display: grid;
  gap: 12px;
}

.guide-section {
  padding: 14px 14px 13px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.guide-section-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
  color: #f3ebff;
  line-height: 1.45;
}

.guide-section-text {
  margin: 0;
  color: #e8deff;
  font-size: 14px;
  line-height: 1.82;
  white-space: pre-line;
}

.guide-tip-box {
  padding: 15px 14px;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.12),
    rgba(96, 165, 250, 0.08)
  );
  border: 1px solid rgba(196, 181, 253, 0.18);
  color: #f5eeff;
  font-size: 14px;
  line-height: 1.78;
}

/* ===== Guide Modal Typography Upgrade ===== */

.app-modal .guide-modal-list,
.app-modal .guide-section,
.app-modal .guide-section-title,
.app-modal .guide-section-text,
.app-modal .guide-tip-box,
.app-modal .guide-lang-btn {
  letter-spacing: 0;
}

.app-modal.guide-lang-en .app-modal-eyebrow,
.app-modal.guide-lang-en .app-modal-title,
.app-modal.guide-lang-en .app-modal-message,
.app-modal.guide-lang-en .guide-lang-btn,
.app-modal.guide-lang-en .guide-section-title,
.app-modal.guide-lang-en .guide-section-text,
.app-modal.guide-lang-en .guide-tip-box {
  font-family: "Inter", "Arial", sans-serif;
}

.app-modal.guide-lang-ko .app-modal-eyebrow,
.app-modal.guide-lang-ko .app-modal-title,
.app-modal.guide-lang-ko .app-modal-message,
.app-modal.guide-lang-ko .guide-lang-btn,
.app-modal.guide-lang-ko .guide-section-title,
.app-modal.guide-lang-ko .guide-section-text,
.app-modal.guide-lang-ko .guide-tip-box {
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

.app-modal .app-modal-eyebrow {
  font-size: 13px;
}

.app-modal .app-modal-title {
  font-size: 24px;
  line-height: 1.35;
}

.app-modal .app-modal-message {
  font-size: 15px;
  line-height: 1.75;
}

.guide-section {
  padding: 16px 15px 15px;
}

.guide-content {
  gap: 13px;
}

@media (max-width: 520px) {
  .hero-topbar {
    margin-bottom: 2px;
  }

  .guide-info-btn {
    width: 30px;
    height: 30px;
  }

  .guide-info-icon {
    font-size: 16px;
  }

  .app-modal-panel {
    width: min(95vw, 460px);
    padding: 22px 15px 15px;
  }

  .app-modal .app-modal-eyebrow {
    font-size: 12px;
  }

  .app-modal .app-modal-title {
    font-size: 21px;
    line-height: 1.35;
  }

  .app-modal .app-modal-message {
    font-size: 14px;
    line-height: 1.72;
  }

  .guide-section {
    padding: 14px 13px;
    border-radius: 16px;
  }

  .guide-section-title {
    font-size: 15px;
    line-height: 1.45;
  }

  .guide-section-text,
  .guide-tip-box {
    font-size: 13px;
    line-height: 1.75;
  }

  .guide-lang-btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .guide-language-row {
    justify-content: center;
  }
}

.highlight-strong {
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255,255,255,0.35);
}

.highlight-warning {
  color: #fca5a5;
  font-weight: 700;
}

.highlight-money {
  color: #86efac;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(34,197,94,0.35);
}

.highlight-money-soft {
  color: #bbf7d0;
  font-weight: 700;
}

.highlight-shard {
  color: #60a5fa;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(96,165,250,0.4);
}

.highlight-legendary {
  color: #facc15;
  font-weight: 900;
  text-shadow:
    0 0 10px rgba(250,204,21,0.6),
    0 0 18px rgba(250,204,21,0.4);
}

.highlight-shard {
  color: #60a5fa;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(96,165,250,0.4);
}

/* ===== Mobile fixes: main page ===== */

html {
  background: #04010c;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background-color: #04010c;
  overscroll-behavior-y: none;
}

@supports (-webkit-touch-callout: none) {
  body {
    min-height: -webkit-fill-available;
  }
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app-modal-panel {
  width: min(92vw, 460px);
  max-width: 460px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-actions .primary-btn {
    width: 100%;
  }

  .hero-actions .sound-switch {
    width: 82px;
    height: 34px;
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  .pokeball {
    width: min(74vw, 320px);
  }

  .pokeball-top,
  .pokeball-bottom {
    left: 0;
    width: 100%;
    border-width: 10px;
  }

  .pokeball-top {
    border-bottom-width: 8px;
  }

  .pokeball-bottom {
    border-top-width: 8px;
  }

  .pokeball-middle-line {
    height: 15px;
  }

  .pokeball-center {
    width: 70px;
    height: 70px;
    border-width: 6px;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.14);
  }

  .hero-topbar {
    margin-bottom: 10px;
  }

  .guide-info-btn {
    width: 30px;
    height: 30px;
    margin-right: 4px;
  }

  .logo {
    margin-top: 14px;
  }

  .app-modal {
    padding: 12px;
  }

  .app-modal-panel {
    width: min(100%, 420px);
    margin: 0 auto;
  }

  .app-modal .app-modal-title {
    font-size: 23px;
    line-height: 1.4;
  }

  .app-modal .app-modal-message {
    font-size: 15px;
    line-height: 1.8;
  }

  .guide-section-title {
    font-size: 16px;
    line-height: 1.5;
  }

  .guide-section-text,
  .guide-tip-box {
    font-size: 14px;
    line-height: 1.8;
  }

  .sound-switch-track {
    border-width: 2px;
  }

  .sound-switch-thumb {
    left: 4px;
    width: 18px;
    height: 18px;
  }

  .sound-switch-text {
    font-size: 10px;
  }

  .sound-switch-text.off {
    right: 8px;
  }

  .sound-switch-text.on {
    left: 10px;
  }

  .sound-switch input:checked + .sound-switch-track .sound-switch-thumb {
    left: calc(100% - 22px);
  }

  .legendary-ball-aura {
    inset: -18%;
    filter: blur(16px);
    z-index: 0;
  }

  .pokeball.legendary-mode {
    filter:
      drop-shadow(0 0 28px rgba(250,204,21,0.78))
      drop-shadow(0 0 56px rgba(168,85,247,0.42))
      drop-shadow(0 0 82px rgba(255,255,255,0.20));
  }

  .pokeball.legendary-mode .legendary-ball-aura {
    opacity: 1;
  }
}

/* ===== Stronger legendary glow on mobile ===== */
@media (max-width: 520px) {
  .pokeball.legendary-mode {
    filter:
      drop-shadow(0 0 34px rgba(250,204,21,0.95))
      drop-shadow(0 0 70px rgba(250,204,21,0.55))
      drop-shadow(0 0 96px rgba(168,85,247,0.42));
  }

  .legendary-ball-aura {
    inset: -24%;
    z-index: 1;
    opacity: 0;
    filter: blur(22px);
    background:
      radial-gradient(circle,
        rgba(255,220,110,0.65) 0%,
        rgba(250,204,21,0.42) 28%,
        rgba(168,85,247,0.18) 52%,
        rgba(255,255,255,0) 76%);
  }

  .pokeball.legendary-mode .legendary-ball-aura {
    opacity: 1;
    animation: legendaryAuraPulseMobile 1.9s ease-in-out infinite;
  }
}

@keyframes legendaryAuraPulseMobile {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}