:root {
    --bg: #ffffff;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-soft: #dbeafe;
    --accent: #f59e0b;
    /*--shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.06);*/
    --radius: 12px;
  }
  
  * { box-sizing: border-box; }

  /* 모바일: 탭 시 파란 반투명 하이라이트 제거. 키보드 포커스는 :focus-visible만 링 */
  a,
  button,
  input,
  select,
  textarea,
  [role='button'] {
    -webkit-tap-highlight-color: transparent;
  }

  a:focus:not(:focus-visible),
  button:focus:not(:focus-visible),
  input:focus:not(:focus-visible),
  select:focus:not(:focus-visible),
  textarea:focus:not(:focus-visible),
  [role='button']:focus:not(:focus-visible) {
    outline: none;
  }

  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  [role='button']:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  
  html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
                  Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
  }
  
  a { color: var(--primary); text-decoration: none; }
  a:hover { text-decoration: underline; }
  
  .topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
  }

/* ── Bottom Navigation Bar (mobile tab bar) ─────────────── */
.ls-bottom-nav {
  --ls-nav-inactive: #9ca3af;
  --ls-nav-active: #0199D9;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  z-index: 150;
  min-height: 49px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.ls-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px 5px;
  min-height: 49px;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
}

.ls-nav-item:hover .ls-nav-label {
  color: #6b7280;
}

.ls-nav-item[aria-current="page"]:hover .ls-nav-label {
  color: var(--ls-nav-active);
}

.ls-nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background-color: var(--ls-nav-inactive);
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  transition: background-color 0.15s ease;
}

.ls-nav-icon--home {
  mask-image: url(/images/ic_home.svg);
  -webkit-mask-image: url(/images/ic_home.svg);
}

.ls-nav-icon--search {
  width: 21.6px;
  height: 21.6px;
  mask-image: url(/images/magnify.svg);
  -webkit-mask-image: url(/images/magnify.svg);
  mask-size: 21.6px 21.6px;
  -webkit-mask-size: 21.6px 21.6px;
}

.ls-nav-icon--news {
  mask-image: url(/images/ic_news.svg);
  -webkit-mask-image: url(/images/ic_news.svg);
}

.ls-nav-icon--more {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none !important;
  mask: none !important;
  -webkit-mask: none !important;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--ls-nav-inactive);
  transition: color 0.15s ease;
}

.ls-nav-item[aria-current="page"] .ls-nav-icon {
  background-color: var(--ls-nav-active);
}

.ls-nav-item[aria-current="page"] .ls-nav-icon--more {
  background-color: transparent;
  color: var(--ls-nav-active);
}

.ls-nav-label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ls-nav-inactive);
  font-family: inherit;
  transition: color 0.15s ease;
}

.ls-nav-item[aria-current="page"] .ls-nav-label {
  color: var(--ls-nav-active);
}

/* Page body padding for nav bar */
body:has(.ls-bottom-nav) .container,
body:has(.ls-bottom-nav) main {
  padding-bottom: 76px;
}

  .topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
    max-width: 980px;
    margin: 0 auto;
  }

  /* 언어 선택 — 검색 필터 알약(learnspot-pill-btn--dropdown)과 동일 톤 */
  .app-lang-pill {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    padding: 6px 6px 6px 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
  }

  .app-lang-pill:hover {
    border-color: #d1d5db;
    color: #4b5563;
  }

  .app-lang-select {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: inherit;
    cursor: pointer;
    line-height: 1.2;
  }

  .app-lang-select:focus {
    outline: none;
  }

  /* 언어·정렬 콤보: 모바일 탭 시 얇은 파란 포커스 링 제거 (전역 select:focus-visible 덮어씀) */
  .app-lang-pill .app-lang-select:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .app-lang-pill .app-lang-chevron {
    flex-shrink: 0;
    display: block;
    margin-top: 1px;
    color: currentColor;
    opacity: 0.9;
    pointer-events: none;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
  }

  .brand-logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    flex-shrink: 0;
    text-decoration: none;
  }

  .brand-logo:hover {
    opacity: 0.92;
  }

  .brand-logo:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 6px;
  }

  .brand-logo img {
    display: block;
    height: 22.4px; /* 기존 28px의 80% */
    width: auto;
    max-width: min(41.6vw, 160px);
  }

  /* 홈·검색 공통 상단: 로고 + 마퀴 태그 + 공유 */
  .topbar .brand .detail-share {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 4px;
    min-width: 0;
    min-height: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
  }

  .topbar .brand .detail-share:hover {
    color: var(--text);
    text-decoration: none;
  }

  .topbar .brand .detail-share .detail-topbar-icon-share {
    display: block;
    width: 18px;
    height: 20px;
    max-height: none;
    pointer-events: none;
  }

  .tag {
    color: var(--muted);
    font-size: 13px;
  }

  /* 인덱스 상단: 로고 옆 태그 — 좁은 폭에서 넘치면 한 줄 마퀴 */
  .tag.tag-marquee {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    line-height: 1.35;
  }

  .tag-marquee-track {
    display: inline-flex;
    width: max-content;
    white-space: nowrap;
  }

  .tag-marquee-segment {
    flex-shrink: 0;
    /* 문장 끝 ↔ 다음 문장 시작 사이 여백 (양쪽 동일 너비 → -50% 루프 유지). 왼쪽은 비우고 오른쪽만. */
    padding-right: 1.75rem;
    box-sizing: content-box;
  }

  .tag.tag-marquee:not(.tag--marquee-active) .tag-marquee-segment[aria-hidden='true'] {
    display: none;
  }

  .tag.tag-marquee.tag--marquee-active .tag-marquee-track {
    animation: learnspot-tag-marquee 6s linear infinite;
  }

  @keyframes learnspot-tag-marquee {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(-50%);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .tag.tag-marquee.tag--marquee-active .tag-marquee-track {
      animation: none;
      transform: none;
    }
  }

  .container {
    max-width: 980px;
    margin: 0 auto;
  }
  
  .results-panel { background: transparent; }
  .results-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    padding: 0px 16px 14px 16px;
  }

  .results-meta-primary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    flex: 1;
  }

  .learnspot-sort-pill {
    flex-shrink: 0;
    width: fit-content;
    max-width: min(280px, 46vw);
  }

  .learnspot-sort-pill.app-lang-pill {
    border: none;
    transition: color 0.2s, background-color 0.2s;
  }

  .learnspot-sort-pill.app-lang-pill:hover {
    border: none;
  }

  .learnspot-sort-pill .app-lang-select {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .muted { color: var(--muted); font-size: 13px; }
  
  .results { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }

  .results > li.card:not(:last-child) {
    border-bottom: 1px solid rgba(17, 24, 39, 0.03);
  }
  
  .card {
    background: var(--surface);
    padding: 0;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform .08s ease, border-color .12s ease;
    outline: none;
  }
  .card:hover { border-color: var(--primary); transform: translateY(-1px); }
  .card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }
  .card-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 14px;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 12px 8px 25px 10px;
    border-radius: var(--radius);
  }
  .card-media {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #ffffff;
  }
  .card-media.card-media--placeholder {
    background: #f0f0f0;
  }
  .card-media.card-media--placeholder .card-thumb {
    display: none;
  }
  .card-media.card-media--html {
    background: none;
    padding: 0;
    overflow: hidden;
  }
  .card-media.card-media--html > * {
    width: 100%;
    height: 100%;
  }
  .card-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
  }
  /* 썸네일 좌측, 본문 우측 — 본문이 남는 폭을 채움 */
  .card-body {
    flex: 1 1 auto;
    min-width: 0;
    align-self: stretch;
  }
  .card h3 { margin: 0 0 4px; font-size: 17px; }
  .card .meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
  /* 인덱스 목록 카드: 서브urb 핀 태그 + 전화 (주소 전체는 표시하지 않음) */
  .results-panel .learnspot-card-location-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 8px;
  }
  .results-panel .learnspot-card-suburb-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 4px;
    border-radius: 5px;
    background: #f3f4f6;
    color: #111827;
    font-size: 13px;
  }
  .results-panel .learnspot-card-suburb-icon {
    flex-shrink: 0;
    display: block;
    color: #111827;
    opacity: 0.92;
  }
  .results-panel .learnspot-card-phone {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
  }
  .card .badges {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
  }

  .learnspot-card-badges-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .learnspot-card-badges-row:empty {
    display: none;
  }
  .badge {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 999px;
    font-weight: 600;
  }
  .badge.exam { background: #fef3c7; color: #92400e; }
  
  .card .feature { color: #374151; font-size: 14px; margin-bottom: 6px; }
  
  .modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
  }
  .modal[hidden] { display: none; }
  .modal-card {
    background: #fff;
    border-radius: var(--radius);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
  }
  .modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: 0;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
  }
  .modal-card h2 { margin: 0 0 6px; font-size: 22px; }
  .modal-card .row { padding: 8px 0; border-bottom: 1px dashed var(--border); }
  .modal-card .row:last-child { border-bottom: 0; }
  .modal-card .row b { display: inline-block; width: 84px; color: var(--muted); font-weight: 600; font-size: 13px; }

  .modal-hero {
    margin: -8px -8px 12px -8px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--primary-soft);
    aspect-ratio: 16 / 7;
    max-height: 200px;
  }
  .modal-hero--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
  }
  .modal-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .modal-hero-ph {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
    max-width: 320px;
  }
  .modal-head { margin-bottom: 12px; }
  .modal-dl {
    margin: 0;
    display: grid;
    gap: 0;
  }
  .modal-dl dt {
    margin: 0;
    padding: 10px 0 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.02em;
  }
  .modal-dl dd {
    margin: 0;
    padding: 0 0 12px;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
  }
  .modal-dl dd:last-of-type {
    border-bottom: 0;
  }
  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .preserve {
    white-space: pre-wrap;
    word-break: break-word;
  }
  
  .empty {
    margin: 0px 10px 0px 10px;
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
  }
  
  .footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 24px 20px 32px;
  }

  .about-legal {
    margin-top: 32px;
    padding: 0 4px 8px;
    text-align: center;
  }

  .about-legal p {
    margin: 0 0 10px;
    font-size: 12px;
    line-height: 1.55;
    color: #9ca3af;
  }

  .about-legal p:last-child {
    margin-bottom: 0;
  }

  .about-legal .about-legal-copy {
    font-size: 12px;
    color: #6b7280;
  }
  
  @media (max-width: 560px) {
    .topbar {
      padding: 10px 10px 7px 15px;
      border-bottom: 1px solid var(--border);
    }

    .card-inner {
      flex-direction: row;
      align-items: flex-start;
    }
    .card-media {
      width: 80px;
      height: 120px;
      flex-shrink: 0;
    }
    /* 인덱스 목록 카드: 좁은 화면에서 특징 줄 폭 확보 */
    .results-panel .card .feature {
      font-size: 12px;
    }
  }
