/* =========================================
   BuddyPlanner v2 — Base & Reset
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/variable/pretendardvariable-dynamic-subset.css');

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

img, svg, video {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transform: translateZ(0);
}

body {
  font-family: var(--font-sans);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--text-100);
  background: var(--bg-app);
  background-image: var(--grad-bg-radial);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 한국어가 단어 중간에서 끊기지 않게 (긴 영문/URL은 줄바꿈 허용) */
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }

button {
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: inherit; color: inherit;
  outline: none; -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font-family: inherit; font-size: inherit; color: inherit;
  border: none; outline: none; background: none;
  -webkit-appearance: none; appearance: none;
}

ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ── App Shell ── */
#app {
  position: relative;
  width: 100%;
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-elevated);
  overflow: hidden;
}

/* Desktop frame */
@media (min-width: 431px) {
  body {
    background: #000;
  }
  #app {
    box-shadow: 0 0 40px rgba(0,0,0,0.05), inset 0 0 0 1px var(--border-subtle);
    border-radius: 0;
    margin-top: 0;
    margin-bottom: 0;
    min-height: 100vh;
  }
}

/* ── Screen System ── */
.screen { display:none; flex-direction:column; min-height:100vh; min-height:100dvh; }
@media (min-width: 431px) {
  .screen { min-height: calc(100vh - 40px); }
}
.screen.active { display:flex; animation: screenIn var(--dur-normal) var(--ease-out); }

.screen-scroll {
  flex:1; overflow-y:auto; overflow-x:hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--header-h);
  padding-bottom: calc(var(--safe-bottom) + 140px); /* Space for sticky ad + extra margin */
}

/* ── Keyframes ── */
@keyframes screenIn {
  from { opacity:0; transform:translateY(6px); }
  to { opacity:1; transform:translateY(0); }
}
@keyframes slideUp {
  from { opacity:0; transform:translateY(20px); }
  to { opacity:1; transform:translateY(0); }
}
@keyframes fadeIn {
  from { opacity:0; }
  to { opacity:1; }
}
@keyframes scaleIn {
  from { opacity:0; transform:scale(0.95); }
  to { opacity:1; transform:scale(1); }
}
@keyframes pulse {
  0%,100% { opacity:1; }
  50% { opacity:0.4; }
}
@keyframes float {
  0%,100% { transform:translateY(0); }
  50% { transform:translateY(-6px); }
}
@keyframes glow {
  0%,100% { box-shadow: 0 0 10px rgba(34,201,135,0.2); }
  50% { box-shadow: 0 0 24px rgba(34,201,135,0.45); }
}
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes dotBounce {
  0%,80%,100% { transform:scale(0); }
  40% { transform:scale(1); }
}
@keyframes rippleEffect {
  to { transform: scale(4); opacity:0; }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Utilities ── */
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

::-webkit-scrollbar { width:3px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: var(--r-full); }
::selection { background: rgba(34,201,135,0.25); color: var(--text-100); }

/* ── Bottom Navigation Bar (GNB) ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-w);
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: var(--safe-bottom);
  z-index: var(--z-sticky);
}
.gnb-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--gray-700);
  transition: all var(--dur-normal) var(--ease-spring);
}
.gnb-item.active {
  color: var(--accent);
  transform: translateY(-1px);
}
.gnb-item svg {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 0 0 rgba(255,91,41,0));
  transition: filter var(--dur-normal) ease;
}
.gnb-item.active svg {
  filter: drop-shadow(var(--glow-accent));
}
.gnb-item .nav-label {
  font-size: 10px;
  font-weight: var(--fw-medium);
}

/* 하단 광고 배너(약 62px)가 보일 때 화면 맨 아래 내용이 가려지지 않도록 여백 추가 */
body.ad-visible .screen.active::after {
  content: '';
  display: block;
  flex: none;
  height: 72px;
}
