/* layout.css | 큰 틀: 상단바, 하단 메뉴, 본문 폭, 푸터 (모바일 우선 -> 큰 화면은 min-width 로 확장) */
.site-header {
  position: sticky; top: 0; z-index: 30; height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); box-shadow: 0 4px 20px rgba(110, 80, 200, .05);
}
.header-inner {
  max-width: var(--maxw); height: var(--header-h); margin: 0 auto; padding: 0 .7rem;
  display: flex; align-items: center; gap: .4rem;
}
.brand { display: flex; align-items: center; gap: .45rem; font: 700 1.5rem/1 var(--font-head); letter-spacing: -.01em; color: #262a6b; white-space: nowrap; min-width: 0; }
.brand img { flex: none; height: 30px; width: auto; }
.brand span { overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; }
.top-nav { display: none; gap: .15rem; margin-left: 1.5rem; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex: none; }
.lang-select {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: .35rem .7rem;
  font-size: .8rem; max-width: 5.2rem; min-height: 38px; font-weight: 600; padding-inline: .5rem;
}
.header-avatar { display: inline-flex; }
.header-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--text); background: var(--surface-2); }
.header-icon:hover { text-decoration: none; background: var(--primary-soft); color: var(--primary); }

.nav-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .72rem; font-weight: 600; padding: .35rem .25rem; border-radius: 14px; flex: 1; min-width: 0;
}
.nav-link > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link:hover { text-decoration: none; color: var(--primary); }
.nav-link.active { color: var(--primary); background: var(--primary-soft); }
.signin-btn { gap: .35rem; padding-inline: 1rem; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; gap: .25rem;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: .4rem .5rem env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(110, 80, 200, .08);
}
body.no-nav .bottom-nav { display: none; }
.bottom-nav { gap: .1rem; padding-inline: .25rem; }
.bottom-nav .nav-link { min-width: 0; font-size: .68rem; }

.view {
  max-width: var(--maxw); margin: 0 auto; padding: 1rem 1rem 2rem;
  outline: none;
}

/* ---- 푸터 ---- */
.site-footer { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem calc(var(--nav-h) + env(safe-area-inset-bottom) + 1.5rem); }
.footer-tag { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem .7rem; margin: 0 0 .9rem; padding: 1rem; border-radius: 22px; background: linear-gradient(90deg, #f3ebff, #ffeef3); color: var(--primary); font-weight: 700; }
.footer-tag strong { font: 700 1.3rem var(--font-head); color: var(--text); }
.footer-tag img { height: 24px; width: auto; }
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; justify-content: center; margin-bottom: .75rem; }
.footer-links a { color: var(--muted); font-weight: 600; font-size: .9rem; }
.footer-links a:hover { color: var(--primary); }
.footer-social { display: flex; gap: .5rem; justify-content: center; margin-bottom: .75rem; }
.footer-social a { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 .8rem; border-radius: 999px; background: var(--surface-2); color: var(--primary); font-weight: 700; font-size: .85rem; }
.footer-social a:hover { text-decoration: none; background: var(--primary-soft); }
.footer-copy { text-align: center; color: var(--muted); font-size: .8rem; margin: 0; }
body:has(.view.chat-mode) .site-footer { display: none; }

@media (min-width: 900px) {
  .header-inner { padding: 0 1.25rem; gap: .75rem; }
  .top-nav { display: flex; }
  .top-nav .nav-link { flex-direction: row; gap: .45rem; font-size: .98rem; font-weight: 700; flex: none; padding: .55rem .85rem; border-radius: 0; position: relative; }
  .top-nav .nav-link .icon { display: none; }
  .top-nav .nav-link.active { background: none; }
  .top-nav .nav-link.active::after { content: ''; position: absolute; left: .95rem; right: .95rem; bottom: 2px; height: 3px; border-radius: 3px; background: var(--primary); }
  .bottom-nav { display: none; }
  .view { padding: 1.75rem 1.5rem 3rem; }
  .site-footer { padding-bottom: 2rem; }
  h1 { font-size: 1.9rem; }
}

/* 채팅방은 화면 높이를 꽉 채우는 레이아웃 */
.view.chat-mode {
  display: flex; flex-direction: column; padding: 0;
  height: calc(100dvh - var(--header-h) - var(--nav-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-width: 760px;
}
@media (min-width: 900px) {
  .view.chat-mode { height: calc(100dvh - var(--header-h) - 2rem); margin-top: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; padding: 0; }
}
.header-quick { display: inline-flex; gap: .4rem; }
@media (min-width: 900px) { .only-mobile { display: none !important; } }
