/* 견주 사이트 — 모바일 전용 */

/* ============ Reset / Base ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Noto Sans KR", "맑은 고딕", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { font-size: 15px; line-height: 1.55; min-height: 100vh; }

/* 데스크톱 접근 시: 모바일 폭으로 가운데 정렬 */
@media (min-width: 768px) {
  body { background: linear-gradient(135deg, #eef4e1 0%, #dcebc8 100%); }
  .u-app { max-width: 420px; margin: 0 auto; min-height: 100vh; background: var(--bg); box-shadow: 0 0 40px rgba(0,0,0,.08); position: relative; }
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

/* ============ App Shell ============ */
.u-app { padding-bottom: 80px; min-height: 100vh; }

.u-topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: rgba(243,247,236,.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.u-topbar h1 { font-size: 17px; font-weight: 700; }
.u-topbar .back { font-size: 22px; padding: 4px 8px; margin: -4px 0 -4px -8px; color: var(--text); }
.u-topbar .menu { font-size: 20px; padding: 4px 8px; margin: -4px -8px -4px 0; color: var(--text); }
.u-topbar .spacer { flex: 1; }

/* ============ Bottom Bar ============ */
.u-bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 768px) {
  .u-bottombar { max-width: 420px; left: 50%; transform: translateX(-50%); }
}
.u-bottombar a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  height: 64px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: transform .12s ease;
}
.u-bottombar a .ico { font-size: 22px; line-height: 1; transition: transform .15s ease; }
.u-bottombar a.active { color: var(--peach-2); }
.u-bottombar a.active .ico { transform: scale(1.12); }
.u-bottombar a:active { transform: scale(.94); }

/* ============ Page Container ============ */
.u-page { padding: 16px; }
.u-page > h2.section { font-size: 14px; color: var(--muted); margin: 20px 0 10px; font-weight: 600; }
.u-page > h2.section:first-child { margin-top: 0; }

/* ============ Cards ============ */
.u-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--sh-card);
  margin-bottom: 12px;
}

/* ============ Buttons ============ */
.u-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600; font-size: 14px;
  transition: transform .12s ease;
}
.u-btn:active { transform: scale(.96); }
.u-btn.primary {
  background: linear-gradient(135deg, var(--peach), var(--peach-2));
  color: white;
  box-shadow: var(--sh-cta);
}
.u-btn.full { width: 100%; padding: 14px; font-size: 15px; }
.u-btn.danger { background: #fee; color: var(--berry); }

/* ============ Forms ============ */
.u-field { margin-bottom: 14px; }
.u-field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.u-field input, .u-field textarea, .u-field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  color: var(--text);
  transition: border-color .15s ease;
}
.u-field input:focus, .u-field textarea:focus { outline: none; border-color: var(--peach); }
.u-field input:disabled, .u-field textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.u-field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.u-field .err { font-size: 12px; color: var(--berry); margin-top: 4px; }

/* ============ Chips (강아지 탭) ============ */
.u-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 16px 12px;
  margin: 0 -16px;
  scrollbar-width: none;
}
.u-chips::-webkit-scrollbar { display: none; }
.u-chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.u-chip.active {
  background: linear-gradient(135deg, var(--peach), var(--peach-2));
  color: white;
  border-color: transparent;
}

/* ============ Pills ============ */
.u-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 600;
  color: var(--peach-2);
}

/* ============ Empty State ============ */
.u-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.u-empty .icon { font-size: 56px; margin-bottom: 12px; opacity: .5; }
.u-empty p { font-size: 14px; }

/* ============ Grids ============ */
.u-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.u-grid-3 .cell {
  aspect-ratio: 1;
  background: var(--surface-2);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.u-grid-3 .cell img { width: 100%; height: 100%; object-fit: cover; }

.u-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.u-grid-2 .cell {
  aspect-ratio: 1;
  background: var(--surface-2);
  border-radius: 12px;
  overflow: hidden;
}
.u-grid-2 .cell img { width: 100%; height: 100%; object-fit: cover; }

/* ============ Horizontal Scroll ============ */
.u-hscroll {
  display: flex; gap: 12px; overflow-x: auto;
  padding: 4px 16px 12px;
  margin: 0 -16px;
  scrollbar-width: none;
}
.u-hscroll::-webkit-scrollbar { display: none; }

/* ============ Dog Card (홈 가로 스크롤) ============ */
.u-dogcard {
  flex-shrink: 0;
  width: 130px;
  background: var(--surface);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-card);
}
.u-dogcard .photo {
  aspect-ratio: 1;
  background: var(--surface-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
}
.u-dogcard .info { padding: 10px 12px; }
.u-dogcard .info .name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.u-dogcard .info .meta { font-size: 11px; color: var(--muted); }

/* ============ Diary Card ============ */
.u-diary {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--sh-card);
  margin-bottom: 12px;
}
.u-diary .head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.u-diary .head .date { font-size: 12px; color: var(--muted); font-weight: 600; }
.u-diary .content {
  font-size: 14px; line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 10px;
}
.u-diary .photos {
  display: flex; gap: 6px; overflow-x: auto;
  margin: 0 -16px 10px;
  padding: 0 16px;
  scrollbar-width: none;
}
.u-diary .photos::-webkit-scrollbar { display: none; }
.u-diary .photos img {
  width: 100px; height: 100px;
  object-fit: cover; border-radius: 10px;
  flex-shrink: 0;
  cursor: pointer;
}
.u-diary .foot { font-size: 12px; color: var(--muted); }

/* ============ Gallery Day Group ============ */
.u-day-group { margin-bottom: 24px; }
.u-day-group .day-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 0 4px;
}

/* ============ Login Card ============ */
.u-login {
  display: grid; place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.u-login .card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px 28px 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
}
.u-login .brand {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--peach), var(--peach-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 14px;
  box-shadow: var(--sh-cta);
}
.u-login h1 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.u-login .sub { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.u-login .alert {
  background: #fee;
  color: var(--berry);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
}
.u-login .alert.ok { background: #efe; color: var(--sage-2); }

/* ============ Flash ============ */
.u-flash {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  max-width: 90vw;
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: flashIn .3s ease, flashOut .3s ease 2.7s forwards;
}
.u-flash.ok { background: var(--sage-2); }
.u-flash.err { background: var(--berry); }
@keyframes flashIn { from { opacity: 0; transform: translate(-50%, -10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes flashOut { to { opacity: 0; transform: translate(-50%, -10px); } }

/* ============ Greeting Header (Home) ============ */
.u-greet {
  padding: 18px 16px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.u-greet h1 { font-size: 18px; font-weight: 700; }
.u-greet .icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--text);
  box-shadow: var(--sh-card);
}

/* ============ View Detail ============ */
.u-detail .meta {
  font-size: 13px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.u-detail .meta span { white-space: nowrap; }
.u-detail .body {
  font-size: 15px; line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 18px;
}

/* ============ Owner-Dog Info Card (Profile) ============ */
.u-info-row {
  display: flex; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.u-info-row:last-child { border-bottom: none; }
.u-info-row .k { color: var(--muted); }
.u-info-row .v { color: var(--text); font-weight: 600; }

/* ============ Action Notice ============ */
.u-notice {
  font-size: 12px; color: var(--faint);
  text-align: center;
  padding: 12px 0;
}

/* 푸시 토글 스위치 */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #ccc; border-radius: 28px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 22px; width: 22px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--peach-2, #557d2b); }
.switch input:checked + .slider::before { transform: translateX(22px); }
