:root {
  color-scheme: dark;
  --bg: #111111;
  --bg2: #171b21;
  --card: #1a1f27;
  --border: #2a323c;
  --fg: #f4f1ea;
  --muted: #9aa3ad;
  --accent: #2dd4bf;
  --accent-2: #14b8a6;
  --star: #fbbf24;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(0,0,0,.4);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 480px at 8% -8%, #2dd4bf22, transparent),
    radial-gradient(800px 420px at 100% 0%, #14b8a618, transparent),
    var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.app {
  max-width: 32rem;
  margin: 0 auto;
  min-height: 100%;
  padding: 0.75rem 1rem calc(1.5rem + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.35rem 0 0.15rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; flex: 1 1 12rem; }
.brand > div { min-width: 0; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.7rem;
  background: linear-gradient(145deg, #1a1f27, #111);
  border: 1px solid #2dd4bf44;
  display: grid; place-items: center;
  font-size: 1.1rem;
  box-shadow: 0 4px 14px #2dd4bf33;
  flex-shrink: 0;
}
.brand h1 {
  margin: 0; font-size: 1.05rem; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand .tagline { margin: 0; font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lang-select {
  appearance: none;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  flex: 0 0 auto;
  max-width: 7.25rem;
  margin-left: auto;
}

.card {
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card h2 { margin: 0 0 0.75rem; font-size: 0.95rem; font-weight: 700; }
.about { font-size: 0.82rem; color: var(--muted); }
.about p { margin: 0; }

.search-wrap input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--fg);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  outline: none;
}
.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #2dd4bf33;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  gap: 0.5rem;
}
.list-head h2 { margin: 0; }

.empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 0.85rem 0.4rem;
}

.trip-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.1rem;
}
.trip-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.trip-chip.active { background: #12332f; color: var(--accent); border-color: #2dd4bf66; }

.filter-label {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.55rem; }
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}
.chip.active { background: #12332f; color: var(--accent); border-color: #2dd4bf66; }

.place-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.place-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  padding: 0;
  width: 100%;
}
.place-card .thumb {
  aspect-ratio: 4 / 3;
  background: #12161c;
  display: grid; place-items: center;
  color: var(--muted);
  font-size: 1.6rem;
}
.place-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place-card .meta { padding: 0.5rem 0.55rem 0.6rem; }
.place-card .ttl { font-weight: 800; font-size: 0.82rem; line-height: 1.25; }
.place-card .stars { color: var(--star); font-size: 0.72rem; letter-spacing: 0.04em; margin-top: 0.12rem; }
.place-card .sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }
.place-card .why {
  font-size: 0.7rem; color: var(--muted);
  margin-top: 0.2rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.btn {
  appearance: none; border: none; border-radius: 12px;
  padding: 0.75rem 1rem; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #04221e;
  box-shadow: 0 6px 16px #14b8a655;
}
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border);
}
.btn-danger {
  background: #7f1d1d55; color: #fecaca; border: 1px solid #ef444466;
}
.btn-sm { padding: 0.4rem 0.65rem; font-size: 0.78rem; border-radius: 8px; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

label {
  display: grid; gap: 0.35rem;
  font-size: 0.78rem; color: var(--muted); font-weight: 600;
}
input[type="text"], input[type="number"], input[type="url"], input[type="search"],
input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--fg);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #2dd4bf33;
}
.grow { flex: 1; min-width: 0; }

.tools .tool-row, .tool-row {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
}
.hint { margin: 0 0 0.55rem; font-size: 0.72rem; color: var(--muted); }

.footer {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  justify-content: center; font-size: 0.78rem; color: var(--muted);
  padding: 0.25rem 0 0.5rem;
}

.ad-slot {
  min-height: 100px; width: 100%;
  border: 1px dashed #3a4450; border-radius: 12px;
  background: #12161c88; overflow: hidden;
}
.ad-slot .adsbygoogle { display: block; min-height: 90px; width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + var(--safe-b));
  transform: translateX(-50%) translateY(120%);
  background: #04221e; color: #bbf7d0; border: 1px solid #16a34a88;
  padding: 0.65rem 1rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700;
  opacity: 0; transition: transform .25s ease, opacity .25s ease;
  z-index: 50; max-width: calc(100% - 2rem); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.dialog {
  border: none; border-radius: 16px; padding: 0;
  max-width: 22rem; width: calc(100% - 1.6rem);
  background: var(--card); color: var(--fg);
  box-shadow: var(--shadow);
  max-height: calc(100% - 2rem);
}
.dialog::backdrop { background: rgba(6, 8, 12, 0.72); }
.dialog-form { display: grid; gap: 0.7rem; padding: 1.05rem 1.05rem 1rem; }
.dialog-form h2 { margin: 0; font-size: 1rem; }
.dialog-actions { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.2rem; }

.drop {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.7rem;
  background: var(--bg2);
  text-align: center;
}
.drop p { margin: 0 0 0.5rem; font-size: 0.78rem; color: var(--muted); }
.drop img { max-height: 180px; width: 100%; object-fit: contain; border-radius: 8px; margin-bottom: 0.5rem; }

.tag-fieldset { border: 0; padding: 0; margin: 0; }
.tag-fieldset legend { font-size: 0.78rem; color: var(--muted); font-weight: 600; margin-bottom: 0.35rem; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 0.7rem; }
.check {
  display: flex; flex-direction: row; align-items: center; gap: 0.3rem;
  font-size: 0.78rem; color: var(--fg); font-weight: 600;
}
.check input { width: auto; accent-color: var(--accent); }

.map {
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #12161c;
}
.leaflet-container { background: #12161c; font-family: inherit; }

@media (min-width: 520px) {
  .app { padding-top: 1.2rem; max-width: 36rem; }
  .place-grid { grid-template-columns: 1fr 1fr 1fr; }
}
