:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2e2e2;
  --card-bg: #fafafa;
  --accent: #2f6fed;
  --tag-large: #eef2ff;
  --tag-large-fg: #3346a8;
  --tag-mid: #f3f4f6;
  --tag-mid-fg: #4b5563;
  --tag-small: #ecfdf5;
  --tag-small-fg: #0f766e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #f0f0f0;
    --muted: #a0a0a0;
    --border: #2c2f36;
    --card-bg: #1c1f26;
    --accent: #6d9bff;
    --tag-large: #1f2a52;
    --tag-large-fg: #c3d0ff;
    --tag-mid: #2a2e37;
    --tag-mid-fg: #d1d5db;
    --tag-small: #123934;
    --tag-small-fg: #7fe0cf;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

.site-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.trust-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.filters {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1 1 100px;
}

.filter-field--wide { flex: 2 1 200px; }

.filter-field select,
.filter-field input {
  margin-top: 4px;
  padding: 10px 8px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
  min-height: 40px;
}

.filter-group--location {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}

.location-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
}

.filter-chip.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.btn-primary {
  align-self: flex-end;
  padding: 10px 16px;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-field select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.filter-detail {
  margin-top: 10px;
}

.filter-detail summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: underline;
  list-style: none;
}

.filter-detail summary::-webkit-details-marker {
  display: none;
}

.filter-detail[open] summary {
  margin-bottom: 10px;
}

.filter-detail .filter-group--category {
  margin-top: 10px;
}

.btn-text {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

.result-count {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 12px 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
}

.view-switch__button {
  min-height: 34px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.view-switch__button.is-active {
  background: var(--accent);
  color: #fff;
}

body[data-view="list"] .map-section,
body[data-view="map"] .results {
  display: none;
}

body[data-view="map"] #map.map-active {
  height: min(68vh, 560px);
}

.map-section { margin: 12px 0; }

.map-placeholder {
  height: 160px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 8px;
}

#map.map-active { height: 320px; border-style: solid; }

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.academy-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 12px 14px;
}

.academy-card__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.academy-card__name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.academy-card__dong {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
  margin-right: 6px;
}

.tag--large { background: var(--tag-large); color: var(--tag-large-fg); }
.tag--mid { background: var(--tag-mid); color: var(--tag-mid-fg); }
.tag--small { background: var(--tag-small); color: var(--tag-small-fg); }

.academy-card__meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.academy-card__meta a {
  color: var(--accent);
  text-decoration: none;
}

.academy-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.academy-card__facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 9px 0 0;
}

.academy-card__facts div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 7px;
  background: var(--bg);
}

.academy-card__facts dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
}

.academy-card__facts dd {
  margin: 1px 0 0;
  color: var(--fg);
  font-size: 0.78rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.academy-card__link {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

.map-info-window {
  max-width: 220px;
  padding: 8px 10px;
  color: #1a1a1a;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 12px;
  line-height: 1.4;
}

.map-info-window strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.map-info-window p {
  margin: 0 0 5px;
}

.map-info-window a {
  color: #2f6fed;
  font-weight: 700;
  text-decoration: none;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
  font-size: 0.9rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}

body.landing {
  display: flex;
  min-height: 100vh;
}

.landing-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 20px;
  text-align: center;
}

.hero h1 {
  font-size: 1.65rem;
  line-height: 1.25;
  margin: 0 0 8px;
  word-break: keep-all;
}

.hero-sub {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
  word-break: keep-all;
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 24px;
}

.btn-cta {
  display: inline-block;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.mission {
  margin: 32px 0;
  padding: 20px 16px;
  border-left: 3px solid var(--accent);
  background: var(--card-bg);
  border-radius: 0 10px 10px 0;
  text-align: left;
}

.mission-quote {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  word-break: keep-all;
}

.mission-quote strong {
  color: var(--accent);
}

.features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 24px 0 24px;
  text-align: left;
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 16px;
}

.feature-card h2 {
  font-size: 1rem;
  margin: 0 0 6px;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.landing-footnote {
  font-size: 0.72rem;
  color: var(--muted);
}

.site-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--border);
}
