/* 냥집 모바일 UI */
:root {
  --nz-bg: #f7f4ef;
  --nz-surface: #ffffff;
  --nz-ink: #2a2622;
  --nz-ink-soft: #6b645c;
  --nz-ink-mute: #9a9288;
  --nz-line: #ebe6de;
  --nz-line-strong: #ddd6cb;
  --nz-accent: #e07a3d;
  --nz-accent-soft: #fdf0e6;
  --nz-accent-deep: #c45f24;
  --nz-board-tag: #8b7355;
  --nz-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nz-header-h: 52px;
  --nz-tabs-h: 44px;
  --nz-bottom-h: 56px;
  --nz-item-h: 92px;
}

html, body {
  height: 100%;
  background: var(--nz-bg) !important;
  color: var(--nz-ink);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif !important;
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

#hd_login_msg { display: none !important; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { max-width: 100%; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--nz-surface);
  position: relative;
  box-shadow: 0 0 0 1px rgba(42, 38, 34, 0.04);
}

/* 상단 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nz-header-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--nz-surface);
  border-bottom: 1px solid var(--nz-line);
}
.topbar__brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.topbar__logo {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--nz-ink);
  margin: 0;
}
.topbar__logo span { color: var(--nz-accent); }
.topbar__badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--nz-accent-deep);
  background: var(--nz-accent-soft);
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: -0.02em;
}
.topbar__actions { display: flex; gap: 2px; }
.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--nz-ink-soft);
}
.icon-btn:active { background: var(--nz-bg); }
.icon-btn svg { width: 22px; height: 22px; }

/* 서브페이지 타이틀 */
.page-title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--nz-line);
  background: var(--nz-surface);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-title__back {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--nz-ink-soft);
  margin-left: -6px;
}
.page-title__back svg { width: 20px; height: 20px; }

#container {
  padding-bottom: calc(var(--nz-bottom-h) + var(--nz-safe-bottom) + 24px);
}

/* 카페 소개 */
.cafe-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fff9f3 0%, var(--nz-surface) 100%);
  border-bottom: 1px solid var(--nz-line);
}
.cafe-strip__avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #f3d5b5;
  flex-shrink: 0;
  overflow: hidden;
}
.cafe-strip__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cafe-strip__meta { min-width: 0; flex: 1; }
.cafe-strip__name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.cafe-strip__desc {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--nz-ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cafe-strip__stat {
  font-size: 0.72rem;
  color: var(--nz-ink-mute);
  text-align: right;
  line-height: 1.35;
  flex-shrink: 0;
}
.cafe-strip__stat b {
  color: var(--nz-ink-soft);
  font-weight: 600;
}

/* 게시판 탭 */
.board-tabs {
  position: sticky;
  top: var(--nz-header-h);
  z-index: 30;
  height: var(--nz-tabs-h);
  background: var(--nz-surface);
  border-bottom: 1px solid var(--nz-line);
  overflow: hidden;
}
.board-tabs__scroll {
  display: flex;
  gap: 4px;
  height: 100%;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.board-tabs__scroll::-webkit-scrollbar { display: none; }
.board-tab {
  flex: 0 0 auto;
  height: 100%;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--nz-ink-mute);
  position: relative;
  white-space: nowrap;
}
.board-tab.is-on {
  color: var(--nz-ink);
  font-weight: 700;
}
.board-tab.is-on::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--nz-accent);
  border-radius: 2px 2px 0 0;
}

/* 정렬 */
.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  background: var(--nz-bg);
  border-bottom: 1px solid var(--nz-line);
}
.feed-toolbar__sort {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--nz-ink-mute);
}
.feed-toolbar__sort button.is-on {
  color: var(--nz-ink);
  font-weight: 650;
}
.feed-toolbar__hint {
  font-size: 0.72rem;
  color: var(--nz-ink-mute);
}

/* 피드 */
.feed-wrap {
  position: relative;
  background: var(--nz-surface);
  padding-bottom: 8px;
}
.feed-spacer { position: relative; width: 100%; }
.feed-window {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}
.feed-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: var(--nz-item-h);
  padding: 12px 14px;
  border-bottom: 1px solid var(--nz-line);
  background: var(--nz-surface);
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
}
.feed-item:active { background: #faf8f5; }
.feed-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding-top: 1px;
}
.feed-item__board {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--nz-board-tag);
  letter-spacing: -0.01em;
}
.feed-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: keep-all;
  margin: 0;
}
.feed-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.72rem;
  color: var(--nz-ink-mute);
}
.feed-item__meta .dot::before {
  content: '·';
  margin-right: 8px;
  color: #cfc7bc;
}
.feed-item__meta .cmt {
  color: var(--nz-accent-deep);
  font-weight: 600;
}
.feed-item__thumb {
  width: 68px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--nz-bg);
  border: 1px solid var(--nz-line);
  margin-top: 2px;
}
.feed-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.feed-status {
  padding: 18px 14px 8px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--nz-ink-mute);
}
.feed-status .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--nz-line-strong);
  border-top-color: var(--nz-accent);
  border-radius: 50%;
  vertical-align: -3px;
  margin-right: 6px;
  animation: nz-spin 0.7s linear infinite;
}
@keyframes nz-spin { to { transform: rotate(360deg); } }

/* FAB */
.fab-write {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: calc(var(--nz-bottom-h) + var(--nz-safe-bottom) + 14px);
  z-index: 50;
  height: 46px;
  padding: 0 16px 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--nz-accent);
  color: #fff !important;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-radius: 24px;
  box-shadow: 0 4px 14px rgba(192, 95, 36, 0.28);
}
.fab-write:active { background: var(--nz-accent-deep); }
.fab-write svg { width: 18px; height: 18px; }

/* 하단 탭바 */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  z-index: 45;
  height: calc(var(--nz-bottom-h) + var(--nz-safe-bottom));
  padding-bottom: var(--nz-safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--nz-surface);
  border-top: 1px solid var(--nz-line-strong);
}
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--nz-ink-mute);
}
.tabbar__item.is-on { color: var(--nz-accent-deep); }
.tabbar__item svg { width: 22px; height: 22px; }

@media (min-width: 720px) {
  body { background: #e8e2d8 !important; }
  .app {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100vh - 48px);
    border-radius: 12px;
    overflow: hidden;
  }
}
