@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

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

:root {
  --primary:   #4361EE;
  --green:     #10B981;
  --amber:     #F59E0B;
  --red:       #EF4444;
  --bg:        #F7F8FC;
  --surface:   #FFFFFF;
  --border:    #E8EBF2;
  --text:      #1A1D2E;
  --muted:     #6B7280;
  --light:     #9CA3AF;
}

body {
  margin: 0; padding: 0;
  font-family: 'Noto Sans KR', -apple-system, 'Malgun Gothic', sans-serif;
  font-size: 16px; line-height: 1.6;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* 앱 컨테이너 */
#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
}

/* 스크롤바 숨기기 */
::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: white; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; height: 56px; padding: 0 16px; gap: 12px;
}
.topbar-logo { font-size: 20px; }
.topbar-title { font-size: 15px; font-weight: 900; line-height: 1.2; }
.topbar-sub   { font-size: 11px; color: var(--muted); }
.topbar-spacer { flex: 1; }
.topbar-back  { background: none; border: none; padding: 4px; cursor: pointer; display: flex; align-items: center; }

/* 하단 탭바 */
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  background: white; border-top: 1px solid var(--border);
  display: flex; z-index: 50;
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 8px 4px;
  text-decoration: none; color: var(--light);
  font-size: 10px; font-weight: 500; gap: 3px;
  transition: color .15s;
}
.bottomnav a.active { color: var(--primary); font-weight: 700; }
.bottomnav svg { display: block; }

/* 페이지 공통 */
.page { padding: 16px; padding-bottom: 90px; }
.page-title { font-size: 20px; font-weight: 900; margin: 0 0 16px; }

/* 카드 */
.card {
  background: white; border-radius: 16px; padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card + .card { margin-top: 12px; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 20px; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  border: none; transition: opacity .15s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: white; }
.btn-amber    { background: #D97706; color: white; }
.btn-outline  { background: white; color: var(--muted); border: 2px solid var(--border); }
.btn-block    { width: 100%; }

/* 입력 */
.input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 2px solid var(--border); border-radius: 12px;
  font-size: 16px; font-family: inherit; outline: none;
  transition: border-color .15s; background: white;
}
.input:focus { border-color: var(--primary); }
.input-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: block; }

/* 배지 */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
}

/* 피드 카드 */
.feed-card { background: white; border-radius: 16px; padding: 16px; border: 1px solid var(--border); }
.feed-card + .feed-card { margin-top: 10px; }
.feed-author { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.feed-avatar { width: 36px; height: 36px; border-radius: 50%; background: #EEF2FF; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.feed-name   { font-size: 13px; font-weight: 700; }
.feed-dong   { font-size: 11px; color: var(--muted); }
.feed-time   { font-size: 11px; color: var(--light); }
.feed-body   { font-size: 14px; color: #374151; line-height: 1.6; }
.feed-body.clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feed-footer { display: flex; gap: 16px; padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--bg); }
.feed-btn    { background: none; border: none; cursor: pointer; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; padding: 0; font-family: inherit; min-height: 0; }

/* 투표 */
.vote-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.vote-bar-fill { height: 100%; border-radius: 4px; transition: width .5s; }
.vote-option-btn {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border);
  background: white; text-align: left; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: border-color .15s, background .15s;
}
.vote-option-btn.selected { border-color: var(--primary); background: #EEF2FF; }

/* 이웃 도우미 */
.helper-card { border-radius: 16px; border: 2px solid #fbbf24; overflow: hidden; }
.helper-header {
  padding: 8px 16px; color: white; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #92400e, #d97706);
}
.helper-body { background: #FFFBEB; padding: 14px 16px; }
.helper-reward { margin-left: auto; background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 20px; font-size: 11px; }

/* 빠른 메뉴 */
.quick-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.quick-icon { width: 56px; height: 56px; background: var(--bg); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 24px; transition: transform .1s; }
.quick-item:active .quick-icon { transform: scale(.88); }
.quick-label { font-size: 11px; color: var(--muted); font-weight: 500; }

/* 진행바 */
.progress-wrap { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 4px; transition: width .5s; }

/* 모달 오버레이 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 430px; background: white;
  border-radius: 24px 24px 0 0; padding: 24px;
}
.modal-title { font-size: 18px; font-weight: 900; margin: 0 0 16px; text-align: center; }

/* 빈 상태 */
.empty-state { padding: 48px 16px; text-align: center; }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* 배너 그라데이션 */
.banner-primary { background: linear-gradient(135deg, var(--primary), #3451D1); border-radius: 16px; padding: 16px; color: white; }

/* 섹션 제목 */
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 0 10px; }

/* 투표 카드 */
.vote-card {
  background: white; border-radius: 16px; padding: 16px;
  border: 2px solid rgba(67,97,238,.15); cursor: pointer;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  text-decoration: none; color: inherit; transition: transform .1s;
}
.vote-card:active { transform: scale(.98); }
.vote-card.closed { border-color: var(--border); opacity: .7; }

/* 토스트 */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 14px; font-weight: 500; z-index: 200;
  white-space: nowrap; animation: fadeInUp .2s;
}
@keyframes fadeInUp { from { opacity:0; transform: translateX(-50%) translateY(10px); } }

/* 로그인 화면 */
.auth-screen { min-height: 100dvh; display: flex; flex-direction: column; background: white; padding: 0 24px 24px; }
.auth-header { padding: 80px 0 32px; text-align: center; }
.auth-logo   { font-size: 56px; margin-bottom: 12px; }
.auth-app-name { font-size: 28px; font-weight: 900; }
.auth-sub { font-size: 14px; color: var(--muted); margin-top: 4px; }
