/* 올바꿈 — 모바일 우선 프로토타입 UI */
:root {
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --green-soft: #eaf1fe;
  --ink: #0f172a;
  --muted: #5b6b82;
  --line: #e2e8f0;
  --bg: #f5f8fc;
  --card: #ffffff;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 64px;
  --top-h: 64px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--top-h);
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--green-dark);
}
.brand img { border-radius: 8px; object-fit: cover; background: var(--green-soft); }
.tagline {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--tab-h) + var(--safe-b) + 18px);
}

.screen[hidden] { display: none !important; }
[hidden] { display: none !important; }

.banner {
  background: linear-gradient(135deg, var(--green), #3b82f6);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.banner strong { font-weight: 800; }

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 700;
}

.feed-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.pill {
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.feed {
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}
.thumb {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: var(--green-soft);
}
.card-body { min-width: 0; }
.card-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.points {
  font-weight: 800;
  color: var(--green-dark);
  font-size: 0.95rem;
}
.cond {
  font-size: 0.75rem;
  background: #eef2f7;
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--muted);
}
.dist {
  font-size: 0.75rem;
  color: var(--muted);
}

.screen-title {
  margin: 4px 0 8px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.hint, .note {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.note.warn { color: var(--warn); }

.form {
  display: grid;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.field {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-weight: 400;
}
.field textarea { resize: vertical; min-height: 72px; }

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary {
  background: var(--green);
  color: #fff;
}
.btn.primary:active { background: var(--green-dark); }
.btn.block { width: 100%; }
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toast {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 600;
}

.points-card {
  background: linear-gradient(145deg, #1e40af, #2563eb 55%, #38bdf8);
  color: #fff;
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.points-label { margin: 0; opacity: 0.9; font-size: 0.9rem; }
.points-value {
  margin: 4px 0 8px;
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.points-value small { font-size: 1.1rem; margin-left: 4px; font-weight: 700; }
.points-expire { margin: 0; font-size: 0.8rem; opacity: 0.9; }

.rules {
  margin: 0 0 18px;
  padding: 14px 14px 14px 32px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.rules li { margin: 6px 0; }
.subhead {
  margin: 0 0 8px;
  font-size: 1rem;
}
.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.history li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.9rem;
}
.history .plus { color: var(--green-dark); font-weight: 700; }
.history .minus { color: #c2410c; font-weight: 700; }
.history .when { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.profile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green-soft);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  overflow: hidden;
  padding: 0;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.profile .name {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 1.05rem;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.7rem;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  font-weight: 700;
}
.profile .meta { margin: 0; font-size: 0.85rem; color: var(--muted); }

.menu {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.menu li + li { border-top: 1px solid var(--line); }
.menu button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 14px 16px;
  font-size: 0.95rem;
}

.about {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.about h3 { margin: 0 0 8px; font-size: 1rem; }
.about p { margin: 0 0 8px; font-size: 0.9rem; color: var(--muted); }
.about p:last-child { margin-bottom: 0; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  min-height: var(--tab-h);
  padding: 6px 4px calc(6px + var(--safe-b));
  background: var(--card);
  border-top: 1px solid var(--line);
  max-width: 480px;
  margin: 0 auto;
}
.tab {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 10px;
}
.tab .ico { font-size: 1.2rem; line-height: 1; }
.tab.active {
  color: var(--green-dark);
  font-weight: 700;
}

@media (min-width: 480px) {
  .tabbar {
    left: 50%;
    right: auto;
    width: 480px;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
.empty-mascot {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px 36px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-mascot img {
  width: 140px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.12));
}
.empty-msg {
  margin: 0;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.empty-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.history-empty {
  display: block !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}
.history-empty .empty-mascot {
  width: 100%;
}

.about {
  text-align: center;
}
.about-mascot {
  display: block;
  width: 120px;
  height: auto;
  margin: 0 auto 12px;
  filter: drop-shadow(0 6px 14px rgba(37, 99, 235, 0.14));
}
.about h3 { text-align: center; }
.about p { text-align: left; }

/* 내 동네 / 반경 */
.hood{background:#eef4ff;border:1px solid #d6e4ff;border-radius:14px;padding:10px 12px;margin:8px 0 10px}
.hood-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;font-size:14px}
.hood-label{color:#3b6fd8;font-weight:600}
.hood-link{background:none;border:0;color:#2f62d0;font-size:12px;text-decoration:underline;cursor:pointer;padding:2px}
.radius{display:flex;gap:6px;margin-top:8px}
.radius-btn{flex:1;border:1px solid #bcd2ff;background:#fff;color:#2f62d0;border-radius:999px;padding:6px 0;font-size:13px;cursor:pointer}
.radius-btn.active{background:#2f6bff;color:#fff;border-color:#2f6bff;font-weight:600}
.geo-note{margin:8px 0 0;font-size:12px;color:#5a6b8c}

/* 동네 게시판 */
#boardWriteBtn { margin-bottom: 12px; }
.board-form { margin-bottom: 14px; }
.board-actions { display: flex; gap: 8px; }
.board-list { display: flex; flex-direction: column; gap: 10px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.post.mine { border-color: var(--green); }
.post-cat { margin: 0 0 4px; font-size: 0.78rem; color: var(--green-dark); font-weight: 700; }
.post-title { margin: 0 0 6px; font-size: 1rem; }
.post-body { margin: 0 0 8px; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.post-meta { margin: 0; font-size: 0.75rem; color: var(--muted); }
#boardCancel { background: var(--green-soft); color: var(--green-dark); }
