@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Jua&display=swap');

:root {
  --primary-color: #ff6b9d;
  --secondary-color: #667eea;
  --bg-gradient: linear-gradient(135deg, #fff0f5 0%, #e0c3fc 50%, #8ec5fc 100%);
  --card-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  --card-hover-shadow: 0 15px 35px rgba(255, 107, 157, 0.2);
  --text-main: #2c3e50;
  --text-sub: #5d6d7e;
  --radius-lg: 30px;
  --radius-md: 24px;
  --radius-sm: 16px;
}

/* =========================================
   Global Reset & Base Styles
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-main);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  line-height: 1.6;
}

/* Cute Background Patterns */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(#ff9a9e 2px, transparent 2px),
    radial-gradient(#a18cd1 2px, transparent 2px);
  background-size: 40px 40px, 30px 30px;
  background-position: 0 0, 15px 15px;
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

/* =========================================
   Layout Container
   ========================================= */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================
   Navigation
   ========================================= */
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  margin-bottom: 30px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
}

.nav a {
  color: var(--text-sub);
  text-decoration: none;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.5);
  white-space: nowrap;
}

.nav a:active,
.nav a:hover {
  background: white;
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(255, 107, 157, 0.2);
}

/* =========================================
   Toggle Button (Game/Hub)
   ========================================= */
.mode-toggle-area {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 20px;
  position: relative;
  z-index: 10;
}

.mode-btn {
  background: white;
  border: 2px solid var(--primary-color);
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  min-height: 48px;
}

.mode-btn:hover {
  transform: translateY(-2px);
  background: #fff0f5;
}

.mode-btn:active {
  transform: scale(0.96);
}

.btn-icon {
  font-size: 1.4rem;
}

/* =========================================
   3D Scene & Sections
   ========================================= */
.scene {
  perspective: 1200px;
  margin-bottom: 40px;
}

.card-3d {
  width: 100%;
  position: relative;
  display: grid;
  align-items: start;
  grid-template-areas: "card";
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), height 0.28s ease;
}

.card-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  grid-area: card;
  width: 100%;
  align-self: start;
  height: auto;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.face-front {
  transform: rotateY(0deg);
  z-index: 2;
}

.face-back {
  transform: rotateY(180deg);
  z-index: 1;
}

.card-3d:not(.flipped) .face-back,
.card-3d.flipped .face-front {
  pointer-events: none;
}

/* Main Section Styling */
.main-section,
.blog-section {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 1);
}

/* Kakao AdFit Common */
.adfit-center {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 16px 0;
  overflow-x: hidden;
  min-height: 50px;
  /* CLS Prevention */
}

.adfit-center--cta-gap {
  margin: 16px 0 22px;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.logo,
.logo-emoji {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
}

h1 {
  font-family: 'Jua', sans-serif;
  font-size: 2.8rem;
  margin: 10px 0;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

h1 span {
  background: linear-gradient(120deg, #ff9a9e 0%, #fecfef 100%);
  background-repeat: no-repeat;
  background-size: 100% 40%;
  background-position: 0 85%;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-sub);


  /* =========================================
   Intro Section (moved below cards)
   ========================================= */
  .intro-section {
    margin-top: 22px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    text-align: left;
    line-height: 1.8;
    border: 1px solid rgba(0, 0, 0, 0.04);
  }

  .intro-section p {
    margin-bottom: 12px;
    font-size: 15px;
    color: #333;
  }

  .intro-section .intro-note {
    margin-bottom: 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
  }

  font-weight: 500;
}

/* =========================================
   Game Info (below cards)
   ========================================= */
.game-info {
  margin-top: 18px;
  padding-top: 4px;
}

.game-info-title {
  font-family: 'Jua', sans-serif;
  font-size: 1.35rem;
  margin: 0 0 8px;
  color: #2c3e50;
  letter-spacing: -0.02em;
}

.game-info-text {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #333;
  word-break: keep-all;
}

.game-info-note {
  margin: 0;
  font-size: 0.88rem;
  color: #666;
  font-style: italic;
  word-break: keep-all;
}

/* =========================================
   Grid System
   ========================================= */
.site-list {
  display: grid;
  margin-top: 6px;
  margin-bottom: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

/* Card Design */
.site-card {
  background: white;
  padding: 30px 20px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 2px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  min-height: 200px;
  height: auto;
  /* 내용 길면 자연스럽게 늘어나게 */
}

/* Gradient Themes */
.site-card.purple-gradient {
  background: linear-gradient(to bottom, #fff 0%, #f3f0ff 100%);
  border-color: #e0d4fc;
}

.site-card.ai-gradient {
  background: linear-gradient(to bottom, #fff 0%, #f0fffa 100%);
  border-color: #bbf7d0;
}

.site-card.blue-gradient {
  background: linear-gradient(to bottom, #fff 0%, #f0f7ff 100%);
  border-color: #bae6fd;
}

.site-card.pink-gradient {
  background: linear-gradient(to bottom, #fff 0%, #fff0f5 100%);
  border-color: #fecdd3;
}

.site-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  z-index: 2;
}

.site-card:active {
  transform: scale(0.98);
}

.site-icon {
  font-size: 3.5rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.site-card h3 {
  font-family: 'Jua', sans-serif;
  font-size: 1.35rem;
  margin-bottom: 8px;
  color: #333;
  line-height: 1.3;
  word-break: keep-all;
}

.site-card p {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
  word-break: keep-all;

  /* ✅ iPhone 12/작은 화면에서 잘림/… 방지: clamp 제거 */
  display: block;
  overflow: visible;
}

.site-card .badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--primary-color);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 3px 6px rgba(255, 107, 157, 0.3);
}

/* Scroll Indicator */
.scroll-indicator {
  text-align: center;
  margin: 20px 0 40px;
}

.scroll-arrow {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(255, 107, 157, 0.3);
  cursor: pointer;
  animation: bounce 2s infinite;
  font-size: 1.5rem;
  color: var(--primary-color);
  font-weight: bold;
}

.scroll-text {
  margin-top: 10px;
  color: var(--text-sub);
  font-weight: 600;
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-10px);
  }

  60% {
    transform: translateY(-5px);
  }
}

/* =========================================
   Blog Section
   ========================================= */
.blog-section h2 {
  font-family: 'Jua', sans-serif;
  text-align: center;
  font-size: 2rem;
  margin-bottom: 10px;
}

.section-subtitle {
  text-align: center;
  color: var(--text-sub);
  margin-bottom: 40px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.blog-card {
  background: white;
  padding: 25px;
  border-radius: var(--radius-md);
  text-decoration: none;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  min-height: 140px;
  color: inherit;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-shadow);
  border-color: var(--primary-color);
}

.blog-card-icon {
  font-size: 2rem;
  background: #fff5f7;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.blog-card-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.blog-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  word-break: keep-all;
  line-height: 1.3;
}

.blog-card-desc {
  font-size: 0.9rem;
  color: var(--text-sub);
  line-height: 1.5;
  margin-bottom: 15px;
  word-break: keep-all;
}

.blog-card-link {
  margin-top: auto;
  color: var(--primary-color);
  font-weight: 700;
  font-size: 0.9rem;
  align-self: flex-end;
}

/* =========================================
   Footer (NEW)
   ========================================= */
.footer {
  margin-top: 40px;
  padding: 24px 0 calc(24px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.8);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-top {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}

.footer-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
  object-fit: contain;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.footer-title {
  font-family: 'Jua', sans-serif;
  font-size: 1.2rem;
  color: var(--text-main);
}

.footer-subtitle {
  font-size: 0.92rem;
  color: var(--text-sub);
  font-weight: 600;
}

.footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.footer-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.footer-btn-primary {
  background: white;
  color: var(--primary-color);
  border-color: rgba(255, 107, 157, 0.55);
  box-shadow: 0 10px 22px rgba(255, 107, 157, 0.18);
}

.footer-btn:active {
  transform: scale(0.98);
}

.footer-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(255, 107, 157, 0.22);
}

.footer-links {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-sub);
  font-weight: 700;
}

.footer-links a {
  color: var(--text-sub);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.footer-links a:hover {
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.85);
}

.footer-links .dot {
  opacity: 0.5;
}

.footer-bottom {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--text-sub);
}

.footer-copy {
  font-weight: 800;
}

.footer-mini {
  font-weight: 700;
  opacity: 0.9;
}

/* =========================================
   Responsive Breakpoints
   ========================================= */
@media (max-width: 1024px) {
  .container {
    padding: 0 20px;
  }
}

@media (max-width: 768px) {

  .main-section,
  .blog-section {
    padding: 30px 20px;
  }

  h1 {
    font-size: 2.4rem;
  }

  .site-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .site-card {
    padding: 20px 15px;
    min-height: 180px;
  }

  .site-icon {
    font-size: 2.8rem;
    margin-bottom: 10px;
  }

  .site-card h3 {
    font-size: 1.15rem;
  }

  .site-card p {
    font-size: 0.85rem;
  }

  .blog-grid {
    grid-template-columns: 1fr;
  }

  .footer-top {
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .face-back.main-section {
    padding-bottom: 16px;
  }

  .face-back .header {
    margin-bottom: 18px;
  }

  .game-info {
    margin-top: 12px;
  }

  .intro-section {
    padding: 14px 12px 12px;
    margin-top: 12px;
  }

  .intro-title {
    font-size: 1.08rem;
  }

  .intro-lead {
    font-size: 0.86rem;
  }

  .intro-bullets li {
    font-size: 0.84rem;
  }

  .intro-note {
    font-size: 0.78rem;
  }

  .game-info-text {
    font-size: 0.86rem;
  }

  .game-info-note {
    font-size: 0.78rem;
  }

  .game-info {
    margin-top: 14px;
  }

  .game-info-title {
    font-size: 1.15rem;
  }

  .game-info-text {
    font-size: 0.88rem;
  }

  .game-info-note {
    font-size: 0.80rem;
  }

  .face-back.main-section {
    padding-bottom: 18px;
  }

  .container {
    padding: 0 16px;
  }

  .nav {
    padding: 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 6px 14px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .main-section,
  .blog-section {
    padding: 25px 15px;
  }

  .site-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .site-card {
    padding: 16px 10px;
    min-height: 160px;
  }

  .site-icon {
    font-size: 2.2rem;
  }

  .site-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
  }

  .site-card p {
    font-size: 0.75rem;
  }

  .mode-btn {
    font-size: 0.9rem;
    padding: 10px 16px;
    min-height: 44px;
  }

  .footer-inner {
    padding: 0 16px;
  }

  .footer-brand {
    min-width: 0;
  }
}

@media (max-width: 340px) {
  .site-list {
    grid-template-columns: 1fr;
  }

  .site-card {
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 15px;
    min-height: auto;
    padding: 15px;
  }

  .site-icon {
    font-size: 2rem;
    margin-bottom: 0;
  }

  .site-card .badge {
    position: static;
    margin-left: auto;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Scroll To Top */
.scroll-to-top {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: 20px;
  width: 48px;
  height: 48px;
  background: white;
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  color: var(--primary-color);
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 900;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scroll-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

/* =========================================
   Game Mode(back face) only
   ========================================= */
.face-back.main-section {
  max-width: 980px;
  margin: 0 auto;
}

.face-back .site-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 280px));
  justify-content: center;
  gap: 24px;
}

@media (min-width: 768px) {
  .face-back.main-section {
    padding: 32px;
  }

  .face-back .site-card {
    padding: 28px 22px;
  }

  .face-back .header {
    margin-bottom: 20px;
    padding-top: 0;
  }
}

@media (min-width: 1024px) {
  .face-back .site-list {
    grid-template-columns: repeat(auto-fit, minmax(260px, 300px));
  }
}