/* ===== 색 · 모양 토큰 — 놀먹이 색 (하늘색 몸 · 크림 주둥이 · 분홍 볼 · 피자 노랑 · 남색 눈) ===== */
:root {
  --bg: #FFF9F1;          /* 따뜻한 크림 바탕 */
  --surface: #FFFFFF;
  --surface-2: #F3F8FF;   /* 옅은 하늘 */
  --line: #E2EAF5;
  --text: #2B3A55;
  --text-2: #5E6E8A;
  --text-3: #9AA5B8;

  --brand-900: #2B4270;   /* 눈 · 코 남색 */
  --brand-800: #365486;
  --brand-700: #4273B8;   /* 버튼 */
  --brand-600: #5A8FD6;
  --brand-500: #73A8DD;   /* 몸통 */
  --brand-400: #8ABAF1;   /* 몸통 밝은 쪽 */
  --brand-300: #B5D3F6;
  --brand-100: #DDEBFC;
  --brand-50:  #EFF6FF;

  --cream: #F8E8D0;       /* 주둥이 · 귀 안쪽 */
  --pink: #F7C1BC;        /* 볼 */
  --pink-100: #FDEBEA;
  --honey: #E3B25C;       /* 게임패드 */
  --honey-100: #FFF3D6;
  --cheese: #FEEFB0;      /* 피자 치즈 */
  --coral: #E0685A;       /* 페퍼로니 */
  --coral-100: #FBE3DE;

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(43, 66, 112, .06);
  --shadow: 0 1px 2px rgba(43, 66, 112, .05), 0 10px 30px rgba(43, 66, 112, .08);
  --shadow-lg: 0 20px 60px rgba(30, 50, 90, .22);

  --topbar-h: 76px;
  --top: calc(var(--topbar-h) + env(safe-area-inset-top));
  --gutter: clamp(16px, 3.2vw, 40px);
  --ease: cubic-bezier(.32, .72, 0, 1); /* iOS 시트 곡선 */
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; } /* 메뉴·모달이 스크롤을 잠가도 화면이 옆으로 밀리지 않게 */
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 100% -10%, rgba(138, 186, 241, .28), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(247, 193, 188, .32), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  letter-spacing: -0.01em;
  /* 한글이 '보세 / 요.' 처럼 낱글자로 잘리지 않게 (긴 주소·파일명은 그래도 줄바꿈) */
  word-break: keep-all;
  overflow-wrap: break-word;
}
body.locked, body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

/* ===== 상단 고정 헤더 (메뉴를 열어도 항상 맨 위에 보임) ===== */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 70;
  height: var(--top);
  padding: env(safe-area-inset-top) var(--gutter) 0;
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 249, 241, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(226, 234, 245, .9);
}

/* 왼쪽 위 햄버거 버튼 */
.burger {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-content: center; gap: 5px;
  transition: transform .2s var(--ease), background .2s;
}
.burger:active { transform: scale(.92); }
.burger span {
  display: block; width: 20px; height: 2.4px; border-radius: 2px; background: var(--brand-900);
  transition: transform .35s var(--ease), opacity .2s;
}
.burger.open { background: var(--brand-100); }
.burger.open span:nth-child(1) { transform: translateY(7.4px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7.4px) rotate(-45deg); }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  flex: none; width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center; overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(226, 234, 245, .9);
}
.brand-logo img { width: 80%; height: 80%; object-fit: contain; }
.brand-text { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; min-width: 0; }
.brand-title {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(17px, 2.2vw, 22px); font-weight: 800; letter-spacing: -0.03em; color: var(--brand-900);
}
.brand-sub {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%;
  font-size: 13px; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.dday {
  font-size: 12px; font-weight: 700; color: var(--brand-800);
  background: var(--brand-100); padding: 2px 9px; border-radius: var(--r-pill);
}
.dday:empty { display: none; } /* 로그인 전에는 빈 알약이 보이지 않게 */

/* ===== 본문 (아래쪽은 돌아다니는 놀먹이 자리만큼 여유) ===== */
.page { min-height: 100vh; padding: calc(var(--top) + 24px) var(--gutter) 140px; }
.page.enter { animation: pageIn .45s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== 메뉴 (햄버거 아래로 펼쳐지는 둥근 패널) ===== */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(30, 45, 75, .24);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.scrim.show { opacity: 1; pointer-events: auto; }

/* 오른쪽 위 설정 버튼 */
.gear {
  margin-left: auto; flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow); font-size: 18px;
  display: grid; place-items: center;
  transition: transform .3s var(--ease), background .2s;
}
.gear:hover { background: #fff; }
.gear.open { background: var(--brand-100); transform: rotate(90deg); }
.gear-who { margin: 2px 4px 6px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.gear-who b { color: var(--brand-900); }

.menu, .gear-menu {
  position: fixed; z-index: 60;
  top: calc(var(--top) + 10px); left: var(--gutter);
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - var(--top) - 24px);
  max-height: calc(100dvh - var(--top) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border: 1px solid rgba(226, 234, 245, .8);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  transform-origin: top left;
  opacity: 0; visibility: hidden; transform: translateY(-10px) scale(.95);
  transition: opacity .2s, transform .35s var(--ease), visibility 0s linear .35s;
}
.menu.open, .gear-menu.open {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .2s, transform .45s var(--ease), visibility 0s;
}
.gear-menu {
  left: auto; right: var(--gutter);
  width: min(240px, calc(100vw - 2 * var(--gutter)));
  transform-origin: top right;
}
.menu-label { margin: 6px 12px -2px; font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .02em; }
.menu-group { background: var(--surface-2); border-radius: var(--r-lg); padding: 5px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 7px 10px; border-radius: var(--r-md);
  font-weight: 600; font-size: 15px; text-align: left;
  transition: background .15s;
}
.nav-item:hover { background: rgba(221, 235, 252, .7); }
.nav-item.active { background: var(--brand-100); color: var(--brand-900); }
.nav-ico {
  flex: none; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-meta { font-size: 12px; font-weight: 700; color: var(--text-3); background: var(--surface); padding: 1px 8px; border-radius: var(--r-pill); }
.nav-bar { flex: none; width: 44px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.nav-bar i { display: block; height: 100%; background: var(--brand-500); border-radius: 3px; }
.nav-item.action { color: var(--brand-700); }
.nav-item.action .nav-ico { background: var(--brand-100); box-shadow: none; font-weight: 800; }
.menu-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 8px 4px 4px; }
.menu-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2);
  font-size: 13px; font-weight: 700; transition: background .15s;
}
.menu-chip:hover { background: var(--brand-100); color: var(--brand-900); }

@media (max-width: 560px) {
  :root { --topbar-h: 72px; }
  .topbar { gap: 10px; }
  .burger { width: 42px; height: 42px; }
  .gear { width: 40px; height: 40px; font-size: 17px; }
  .brand { flex: 1; min-width: 0; gap: 9px; }
  .brand-logo { width: 38px; height: 38px; border-radius: 12px; }
  .brand-text { flex-direction: column; align-items: flex-start; row-gap: 1px; width: 100%; }
  .brand-title { font-size: 16.5px; }
  .brand-sub { font-size: 12px; }
  /* 날짜 옆 '함께한 지 N일째'는 홈 카드에 그대로 나오니 좁은 화면에서는 뺀다 */
  .topbar .dday { display: none; }
}
@media (max-width: 400px) {
  .brand-title { font-size: 16px; }
  .brand-sub { font-size: 11.5px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 11px; }
}
/* 여기서부터는 제목 자리를 벌기 위해 로고를 뺀다 */
@media (max-width: 355px) {
  .brand-logo { display: none; }
}
