/* ========================================
   ??蹂댄뿕 ?깊뼢 寃??- Global Styles
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-dark:       #080e1f;
  --bg-card:       rgba(255, 255, 255, 0.045);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --border:        rgba(255, 255, 255, 0.08);
  --border-hover:  rgba(255, 255, 255, 0.18);

  --text-primary:   #f0f4ff;
  --text-secondary: rgba(200, 215, 255, 0.65);
  --text-muted:     rgba(160, 180, 220, 0.45);

  --accent-purple:  #a78bfa;
  --accent-blue:    #60a5fa;
  --accent-green:   #34d399;
  --accent-yellow:  #fbbf24;
  --accent-pink:    #f472b6;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(167, 139, 250, 0.15);

  --radius-card: 18px;
  --radius-sm:   10px;

  /* Phone sizing */
  --phone-max-w: 430px;
  --phone-min-h: 100dvh;
}

html, body {
  min-height: 100%;
  background: var(--bg-dark);
  font-family: 'Noto Sans KR', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* ========================================
   Phone Frame (centers on desktop)
   ======================================== */

.phone-frame {
  position: relative;
  width: 100%;
  max-width: var(--phone-max-w);
  min-height: var(--phone-min-h);
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #0b1528 0%, #0f1f3d 40%, #0a1422 100%);
}

/* Desktop: add subtle phone border */
@media (min-width: 500px) {
  body {
    background: #040810;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 0 40px;
  }
  .phone-frame {
    border-radius: 36px;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow:
      0 0 0 8px rgba(255,255,255,0.02),
      0 40px 80px rgba(0,0,0,0.7),
      0 0 120px rgba(100, 140, 255, 0.06);
    min-height: 800px;
  }
}

/* ========================================
   Background Orbs
   ======================================== */

.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.bg-orb-1 {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -60px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, transparent 70%);
  animation: floatOrb 8s ease-in-out infinite;
}

.bg-orb-2 {
  width: 260px;
  height: 260px;
  bottom: 30%;
  left: -80px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.14) 0%, transparent 70%);
  animation: floatOrb 11s ease-in-out infinite reverse;
}

.bg-orb-3 {
  width: 200px;
  height: 200px;
  bottom: 5%;
  right: -40px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.1) 0%, transparent 70%);
  animation: floatOrb 9s ease-in-out infinite 2s;
}

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-20px) scale(1.05); }
}

/* ========================================
   Header
   ======================================== */

.app-header {
  position: relative;
  z-index: 2;
  padding: 52px 24px 24px;
  text-align: center;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent-purple);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 5px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-purple);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

.badge-dot-end {
  animation-delay: 0s; /* ?욎そ ?먭낵 ?숈떆??諛섏쭩??*/
}

.main-title {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.25;
  background: linear-gradient(135deg, #e0e8ff 0%, #a78bfa 50%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.sub-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* ========================================
   Menu Grid
   ======================================== */

.menu-container {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 8px 16px 16px;
}

.menu-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========================================
   Menu Cards
   ======================================== */

.menu-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.menu-card:hover,
.menu-card:focus-visible {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-card);
  outline: none;
}

.menu-card:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Glow effect on hover */
.card-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(167, 139, 250, 0.12), transparent 70%);
  border-radius: inherit;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.menu-card:hover .card-glow {
  opacity: 1;
}

/* ========================================
   MBTI Card (featured / full-width emphasis)
   ======================================== */

.mbti-card {
  background: linear-gradient(135deg,
    rgba(99, 102, 241, 0.18) 0%,
    rgba(139, 92, 246, 0.15) 50%,
    rgba(59, 130, 246, 0.12) 100%
  );
  border-color: rgba(167, 139, 250, 0.35);
  padding: 30px 24px;       /* 1.5횞 vertical padding */
  gap: 22px;
}

.mbti-card .card-glow {
  background: radial-gradient(ellipse at 30% 50%, rgba(167, 139, 250, 0.2), transparent 70%);
}

.mbti-card:hover {
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow:
    0 4px 30px rgba(0,0,0,0.4),
    0 0 40px rgba(139, 92, 246, 0.2);
}

/* ========================================
   Card Icon
   ======================================== */

.card-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  transition: transform 0.25s ease, background 0.25s ease;
}

.menu-card:hover .card-icon {
  transform: scale(1.08) rotate(-3deg);
  background: rgba(255,255,255,0.07);
}

.card-icon svg {
  width: 28px;
  height: 28px;
}

.mbti-icon {
  width: 78px;              /* 52px 횞 1.5 */
  height: 78px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(167, 139, 250, 0.25);
}

.mbti-icon svg {
  width: 48px;              /* 32px 횞 1.5 */
  height: 48px;
}

/* ========================================
   Card Content
   ======================================== */

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* MBTI specific typography */
.mbti-label {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;           /* 28px 횞 1.5 */
  font-weight: 900;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #c4b5fd, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.mbti-sub {
  font-size: 13px;           /* 10.5px 횞 1.25 */
  color: rgba(196, 181, 253, 0.7);
  font-weight: 500;
  letter-spacing: 0.2px;
  margin-top: 4px;
}

/* ========================================
   Card Arrow
   ======================================== */

.card-arrow {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.menu-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--text-secondary);
}

/* ========================================
   Kakao Card special accent
   ======================================== */

.kakao-card {
  background: linear-gradient(135deg,
    rgba(250, 204, 21, 0.12) 0%,
    rgba(202, 138, 4, 0.08) 100%
  );
  border-color: rgba(250, 204, 21, 0.2);
}

.kakao-card:hover {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 4px 30px rgba(0,0,0,0.4), 0 0 30px rgba(250, 204, 21, 0.1);
}

/* ========================================
   Footer
   ======================================== */

.app-footer {
  position: relative;
  z-index: 2;
  padding: 16px 24px 32px;
  text-align: center;
}

.app-footer p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

/* ========================================
   Ripple / tap feedback overlay
   ======================================== */

.ripple-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ========================================
   Scroll behavior
   ======================================== */

.phone-frame {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.phone-frame::-webkit-scrollbar {
  display: none;
}

/* ========================================
   Animations
   ======================================== */

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

.app-header {
  animation: slideUpFade 0.5s ease both;
}

.menu-card:nth-child(1) { animation: slideUpFade 0.45s ease 0.05s both; }
.menu-card:nth-child(2) { animation: slideUpFade 0.45s ease 0.10s both; }
.menu-card:nth-child(3) { animation: slideUpFade 0.45s ease 0.15s both; }
.menu-card:nth-child(4) { animation: slideUpFade 0.45s ease 0.20s both; }
.menu-card:nth-child(5) { animation: slideUpFade 0.45s ease 0.25s both; }
.menu-card:nth-child(6) { animation: slideUpFade 0.45s ease 0.30s both; }
.menu-card:nth-child(7) { animation: slideUpFade 0.45s ease 0.35s both; }
.menu-card:nth-child(8) { animation: slideUpFade 0.45s ease 0.40s both; }
.menu-card:nth-child(9) { animation: slideUpFade 0.45s ease 0.45s both; }

/* ========================================
   Safe area for notched phones
   ======================================== */

@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: max(52px, calc(env(safe-area-inset-top) + 24px));
  }
  .app-footer {
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px));
  }
}

/* ?? ?뚮쭏 ?꾪솚 ?몃옖吏??(硫붿씤 ?붾㈃) ?? */
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.07);
  transition: transform 0.25s ease, background 0.25s ease;
}

.menu-card:hover .card-icon {
  transform: scale(1.08) rotate(-3deg);
  background: rgba(255,255,255,0.07);
}

.card-icon svg {
  width: 28px;
  height: 28px;
}

.mbti-icon {
  width: 78px;              /* 52px 횞 1.5 */
  height: 78px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(167, 139, 250, 0.25);
}

.mbti-icon svg {
  width: 48px;              /* 32px 횞 1.5 */
  height: 48px;
}

/* ========================================
   Card Content
   ======================================== */

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* MBTI specific typography */
.mbti-label {
  font-family: 'Outfit', sans-serif;
  font-size: 42px;           /* 28px 횞 1.5 */
  font-weight: 900;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #c4b5fd, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.mbti-sub {
  font-size: 13px;           /* 10.5px 횞 1.25 */
  color: rgba(196, 181, 253, 0.7);
  font-weight: 500;
  letter-spacing: 0.2px;
  margin-top: 4px;
}

/* ========================================
   Card Arrow
   ======================================== */

.card-arrow {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.menu-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--text-secondary);
}

/* ========================================
   Kakao Card special accent
   ======================================== */

.kakao-card {
  background: linear-gradient(135deg,
    rgba(250, 204, 21, 0.12) 0%,
    rgba(202, 138, 4, 0.08) 100%
  );
  border-color: rgba(250, 204, 21, 0.2);
}

.kakao-card:hover {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 4px 30px rgba(0,0,0,0.4), 0 0 30px rgba(250, 204, 21, 0.1);
}

/* ========================================
   Footer
   ======================================== */

.app-footer {
  position: relative;
  z-index: 2;
  padding: 16px 24px 32px;
  text-align: center;
}

.app-footer p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
}

.footer-notice {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--text-sec) !important;
  margin-bottom: 8px;
  letter-spacing: -0.1px !important;
}
[data-theme="light"] .footer-notice {
  color: #1e293b !important;
}

/* ========================================
   Ripple / tap feedback overlay
   ======================================== */

.ripple-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ========================================
   Scroll behavior
   ======================================== */

.phone-frame {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.phone-frame::-webkit-scrollbar {
  display: none;
}

/* ========================================
   Animations
   ======================================== */

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

.app-header {
  animation: slideUpFade 0.5s ease both;
}

.menu-card:nth-child(1) { animation: slideUpFade 0.45s ease 0.05s both; }
.menu-card:nth-child(2) { animation: slideUpFade 0.45s ease 0.10s both; }
.menu-card:nth-child(3) { animation: slideUpFade 0.45s ease 0.15s both; }
.menu-card:nth-child(4) { animation: slideUpFade 0.45s ease 0.20s both; }
.menu-card:nth-child(5) { animation: slideUpFade 0.45s ease 0.25s both; }
.menu-card:nth-child(6) { animation: slideUpFade 0.45s ease 0.30s both; }
.menu-card:nth-child(7) { animation: slideUpFade 0.45s ease 0.35s both; }
.menu-card:nth-child(8) { animation: slideUpFade 0.45s ease 0.40s both; }
.menu-card:nth-child(9) { animation: slideUpFade 0.45s ease 0.45s both; }

/* ========================================
   Safe area for notched phones
   ======================================== */

@supports (padding-top: env(safe-area-inset-top)) {
  .app-header {
    padding-top: max(52px, calc(env(safe-area-inset-top) + 24px));
  }
  .app-footer {
    padding-bottom: max(32px, calc(env(safe-area-inset-bottom) + 20px));
  }
}

/* ?€?€ ?뚮쭏 ?꾪솚 ?몃옖吏€??(硫붿씤 ?붾㈃) ?€?€ */
.phone-frame, .menu-card, .app-header, body {
  transition: background 0.35s ease, background-color 0.35s ease,
              border-color 0.35s ease, color 0.35s ease;
}

/* ── 테마 토글 래퍼 ── */
.theme-toggle-wrap {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

/* ── 테마 토글 버튼 ── */
#theme-toggle {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  padding: 0;
  color: var(--text-pri);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#theme-toggle svg { display: block; }
#theme-toggle:hover  { transform: scale(1.1); box-shadow: 0 4px 18px rgba(0,0,0,0.26); }
#theme-toggle:active { transform: scale(0.93); }

/* ── 테마 레이블 텍스트 ── */
#theme-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  line-height: 1;
  user-select: none;
}

/* ============================================================
   라이트 모드 (메인 화면) — 화이트/소프트블루/틸
   ============================================================ */
[data-theme="light"] body { background: #e2e8f0; }
[data-theme="light"] .phone-frame {
  background: #f8fafc;
  border-color: rgba(148,163,184,0.25);
}
[data-theme="light"] .bg-orb-1,
[data-theme="light"] .bg-orb-2,
[data-theme="light"] .bg-orb-3 { opacity: 0; }

/* Header */
[data-theme="light"] .header-badge {
  background: rgba(13,148,136,0.1);
  border-color: rgba(13,148,136,0.25);
  color: #0d9488;
}
[data-theme="light"] .badge-dot { background: #0d9488; }
[data-theme="light"] .main-title { color: #1e293b; }
[data-theme="light"] .sub-title  { color: #64748b; }

/* Menu cards */
[data-theme="light"] .menu-card {
  background: #ffffff;
  border-color: rgba(148,163,184,0.2);
  box-shadow: 0 4px 16px rgba(148,163,184,0.08);
}
[data-theme="light"] .menu-card:hover {
  background: rgba(248,250,252,0.8);
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59,130,246,0.12);
}
[data-theme="light"] .card-title { color: #1e293b; }
[data-theme="light"] .card-desc  { color: #64748b; }
[data-theme="light"] .card-glow  { opacity: 0.5; }

/* MBTI card accent */
[data-theme="light"] .mbti-card .card-icon-wrap { background: rgba(139,92,246,0.1); }

/* MBTI 라벨 라이트 모드 — 진하고 선명하게 */
[data-theme="light"] .mbti-label {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #4c1d95;
  background-clip: unset;
  color: #4c1d95;
}
[data-theme="light"] .mbti-sub {
  color: #5b21b6;
}

/* Footer */
[data-theme="light"] .app-footer p { color: #94a3b8; }

/* 토글 버튼 라이트 모드 — 다크 배경으로 명확하게 */
[data-theme="light"] #theme-toggle {
  background: #1e293b;
  border-color: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 2px 14px rgba(15,23,42,0.25);
}
[data-theme="light"] #theme-toggle:hover {
  background: #0f172a;
  box-shadow: 0 4px 20px rgba(15,23,42,0.35);
}
[data-theme="light"] #theme-label {
  color: #1e293b;
  font-weight: 700;
}

@media (min-width: 500px) {
  [data-theme="light"] body { background: #e2e8f0; }
  [data-theme="light"] .phone-frame {
    box-shadow: 0 40px 80px rgba(0,0,0,0.05), 0 0 120px rgba(59,130,246,0.06);
  }
}
