/* Created: 2026-05-10 10:20 */
* { box-sizing: border-box; }
:root {
  --primary: #0f4b8c;
  --primary-dark: #0a3a6f;
  --accent: #f0af23;
  --bg: #f4f6fa;
  --card: #fff;
  --text: #1a1f2c;
  --muted: #6a7280;
  --border: #e3e7ee;
  --green: #1f8a3a;
  --brown: #a06430;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-header {
  background: var(--primary);
  color: white;
  padding: env(safe-area-inset-top, 0) 12px 8px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 6px;
}
.title-row h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255,255,255,0.28); }

.search-row {
  padding: 4px 0 8px;
}
.search-row input {
  width: 100%;
  border: none;
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: white;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.chip.active {
  background: white;
  color: var(--primary);
  border-color: white;
  font-weight: 600;
}

.tab-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.2);
  margin-top: 6px;
}
.tab {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.tab.active {
  color: white;
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.count {
  margin-left: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}
.view {
  display: none;
  flex: 1;
  flex-direction: column;
}
.view.active { display: flex; }

#resultList {
  padding: 10px 12px env(safe-area-inset-bottom, 12px);
}
.card {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
}
.card:active { transform: scale(0.99); }
.card:hover { box-shadow: 0 2px 10px rgba(15,75,140,0.12); }
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.card-head h3 {
  margin: 0;
  font-size: 15px;
  flex: 1;
  font-weight: 600;
  line-height: 1.3;
}
.kind {
  flex: 0 0 auto;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text);
  font-weight: 600;
}
.kind.\30 1 { background: #e3f4e8; color: var(--green); }
.kind.\30 2 { background: #e3edf8; color: var(--primary); }
.kind.\30 3 { background: #f4ebe0; color: var(--brown); }
.meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.addr {
  margin: 0;
  font-size: 13px;
  color: #444;
  line-height: 1.4;
}
.more {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 16px 0 24px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }

#mapView { padding: 0; }
#map {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.sheet-card {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0));
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 4px 8px;
}
.sheet-card h2 {
  margin: 4px 30px 8px 0;
  font-size: 18px;
}
.badge-row {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}
.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text);
}
.badge.kind.\30 1 { background: #e3f4e8; color: var(--green); }
.badge.kind.\30 2 { background: #e3edf8; color: var(--primary); }
.badge.kind.\30 3 { background: #f4ebe0; color: var(--brown); }
.sheet-card .addr {
  color: #333;
  font-size: 14px;
  margin: 8px 0;
}
.benefit {
  background: #f7faff;
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  border-radius: 4px;
}
.remark {
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
  margin: 8px 0 12px;
}
.actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  text-align: center;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  min-width: 100px;
}
.btn.primary {
  background: var(--primary);
  color: white;
}

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,30,40,0.92);
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

@media (min-width: 700px) {
  body { font-size: 16px; }
  #resultList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
    padding: 14px;
  }
  .card { margin-bottom: 0; }
  .sheet-card {
    max-width: 600px;
    margin: 0 auto;
    border-radius: 16px;
    bottom: 5vh;
  }
}
