:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1c1a17;
  --muted: #6f6a62;
  --line: #e4ded4;
  --accent: #b4532a;
  --thumb: #ebe5da;
  --foot-bg: #ede6db;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e0d;
    --surface: #1a1816;
    --text: #ece7df;
    --muted: #9a9389;
    --line: #2c2925;
    --accent: #e08a5c;
    --thumb: #25221f;
    --foot-bg: #161412;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 20px 48px;
}

.intro { margin-bottom: 48px; }

.eyebrow {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 700;
}

.lede {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 960px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

/* 카드: 전체가 사이트 링크(.card-link 확장), 만든 사람 링크만 그 위에 따로 */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.card:hover,
.card:focus-within {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 16px 36px -20px rgba(0, 0, 0, .4);
}

.card-link {
  color: inherit;
  text-decoration: none;
  outline: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
}

.card-link:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }

.thumb {
  position: relative;
  aspect-ratio: 1200 / 630;
  background: var(--thumb);
  border-radius: 12px;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.card:hover .thumb img { transform: scale(1.04); }

.thumb-label {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 18, 16, .62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff6ec;
  font-size: 12px;
  font-weight: 600;
}

.thumb-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 30%, #f0a35e 0%, #b4532a 45%, #2a1710 100%);
  color: #fff6ec;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.card-main { position: relative; flex: 1; display: flex; flex-direction: column; }

.body {
  padding: 12px 6px 10px;
  flex: 1;
}

.card h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 첫 클릭 때 카드 위로 펼쳐지는 자세한 정보 (클릭은 아래 링크로 그대로 전달) */
.detail {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
}

.card.open .detail { opacity: 1; transform: none; z-index: 2; }

/* 펼친 카드 안의 '더 알아보기' → 사이트별 소개 페이지 (이 링크만 클릭을 받음) */
.detail-more {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.card.open .detail-more { pointer-events: auto; }
.card.open .thumb img { transform: none; }

.detail p { margin: 0; }
.detail-name { font-size: 12px; font-weight: 600; color: var(--accent); }
.detail-title { font-size: 15px; font-weight: 700; line-height: 1.4; letter-spacing: -.01em; }

.detail-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-host { margin-top: auto !important; font-size: 12px; color: var(--muted); opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cta-enter { display: none; }
.card.open .cta-details { display: none; }
.card.open .cta-enter { display: inline; }
.card.open { border-color: var(--accent); }

.card-foot {
  display: grid;
  gap: 10px;
  margin: 0 -8px -8px;
  padding: 10px 12px 12px;
  border-top: 1px dashed var(--line);
}

/* 하트 · 서버 상태 · 자세히보기/입장 */
.foot-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.foot-row .enter { margin-left: auto; white-space: nowrap; }

.creator {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  justify-self: start;
  max-width: 100%;
}

a.creator:hover .creator-text { color: var(--accent); }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0a35e, #b4532a);
  color: #fff6ec;
  font-size: 13px;
  font-weight: 700;
}

.creator-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.creator-text small {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}



.enter {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

@media (max-width: 480px) {
  .page { padding: 48px 16px 40px; }
}

/* 모바일 2열: 작게, 서버 상태는 점만 */
@media (max-width: 640px) {
  .card { padding: 6px; border-radius: 14px; }
  .thumb { border-radius: 9px; }
  .thumb-label { display: none; }
  .body { padding: 9px 4px 8px; }
  .card h2 { font-size: 13.5px; }
  .card-foot { margin: 0 -6px -6px; padding: 8px 8px 10px; gap: 8px; }
  .foot-row { gap: 6px; }
  .creator { gap: 6px; font-size: 12px; }
  .avatar { width: 22px; height: 22px; font-size: 11px; }
  .creator-text small { display: none; }
  .health-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .enter { font-size: 12px; }
  .heart { padding: 4px 8px 4px 6px; }
  .detail { padding: 10px 9px; gap: 4px; border-radius: 9px; }
  .detail-title { font-size: 13.5px; }
  .detail-desc { font-size: 12px; -webkit-line-clamp: 5; }
  .admin-edit { top: 12px; right: 12px; padding: 3px 9px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .thumb img { transition: none; }
  .card:hover { transform: none; }
}

/* 정렬 + 검색 */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -24px 0 24px;
}

.sort {
  display: flex;
  gap: 6px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 340px;
  min-width: 0;
}

.search svg {
  position: absolute;
  left: 13px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 9px 76px 9px 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.search kbd, .search-count {
  position: absolute;
  right: 12px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}

.search kbd { padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; }
.search:focus-within kbd, .search-count:not(:empty) ~ kbd, .search:has(.search-count:not(:empty)) kbd { display: none; }

.search-empty {
  padding: 48px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
}

.search-empty[hidden] { display: none; }
.search-empty p { margin: 0 0 6px; }
.search-empty-title { font-size: 17px; font-weight: 700; color: var(--text); }
.search-empty .submit-open { margin-top: 14px; }

@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { flex-basis: auto; }
  .search kbd { display: none; }
}

.sort a {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.sort a:hover { color: var(--text); }

.sort a.on {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.health {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.health::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.health-fast { color: #2f9e5b; }
.health-ok   { color: #c99a1c; }
.health-slow { color: #d0662c; }
.health-down { color: #b9473b; }

/* 푸터 (boundary-crosser.com과 같은 구성) */
.site-foot {
  margin-top: 40px;
  background: var(--foot-bg);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.site-foot-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-foot-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 48px 0;
}

.site-foot h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
}

.site-foot p { margin: 0; color: var(--muted); }

.site-foot-logo img { height: 22px; width: auto; display: block; }

.site-foot-mail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
}

.site-foot-mail:hover { color: var(--accent); }
.site-foot-mail svg { width: 16px; height: 16px; flex: none; }

.site-foot-bottom {
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.8;
}

@media (prefers-color-scheme: dark) {
  .site-foot-logo img { filter: invert(1) brightness(.92); }
}

@media (max-width: 768px) {
  .site-foot-top { grid-template-columns: 1fr; gap: 28px; padding: 40px 0; }
}

@media (max-width: 480px) {
  .site-foot-inner { padding: 0 16px; }
}

/* 신청하기 */
.submit-cta {
  margin-top: 56px;
  padding: 36px 20px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  text-align: center;
}

.submit-cta p { margin: 0 0 14px; color: var(--muted); }

.submit-open,
.submit-send {
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .2s ease;
}

.submit-open:hover,
.submit-send:hover { filter: brightness(1.08); }
.submit-send:disabled { opacity: .6; cursor: wait; }

.submit-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .5);
}

.submit-dialog::backdrop {
  background: rgba(15, 14, 13, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.submit-form,
.submit-done {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.submit-form[hidden],
.submit-done[hidden] { display: none; }

.submit-form header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.submit-dialog h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; }

.submit-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: var(--thumb);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.submit-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.submit-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
}

.submit-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.at-input { position: relative; display: block; }
.at-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 400; }
.at-input input { padding-left: 28px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.submit-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.submit-errors {
  margin: 0;
  padding-left: 18px;
  color: #c0392b;
  font-size: 13px;
}

.submit-done { text-align: center; justify-items: center; padding: 36px 24px 28px; }
.submit-done p { margin: 0; color: var(--muted); }

.done-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent) !important;
  font-size: 24px;
  font-weight: 700;
}

@media (prefers-color-scheme: dark) {
  .submit-open, .submit-send { color: #1c1208; }
}

/* 언어 선택 */
.intro-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.intro-top .eyebrow { margin: 0; }

.langs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}

.langs a {
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.langs a:hover { color: var(--text); }

.langs a.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

@media (max-width: 480px) {
  .intro-top { flex-direction: column-reverse; align-items: flex-start; gap: 20px; }
  .langs { align-self: flex-end; }
}

/* 등록 팝업 언어 탭 */
.submit-i18n {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.submit-i18n-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.submit-i18n-label { font-size: 14px; font-weight: 600; }

.submit-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.submit-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.submit-tabs button.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.submit-tabs .dot { display: none; font-size: 7px; color: #2f9e5b; }
.submit-tabs .filled .dot { display: inline; }

.submit-panel { display: grid; gap: 12px; }
.submit-panel[hidden] { display: none; }
.submit-form label small { font-weight: 400; color: var(--muted); }

.submit-form textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}

.submit-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.submit-i18n-hint { margin: 0; font-size: 12px; color: var(--muted); }

.submit-dialog { max-height: calc(100dvh - 32px); overflow: auto; }

.heart {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.heart svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.heart:hover { color: #e0475b; border-color: #e0475b; }
.heart.on { color: #e0475b; border-color: color-mix(in srgb, #e0475b 40%, transparent); background: color-mix(in srgb, #e0475b 10%, var(--surface)); }
.heart.on svg { fill: currentColor; }
.heart:focus-visible { outline: 2px solid #e0475b; outline-offset: 2px; }
.heart.pop svg { animation: heart-pop .35s ease-out; }

@keyframes heart-pop {
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .heart.pop svg { animation: none; }
}
.heart:not(:has(.heart-count)) { padding: 6px; }

/* 수정/삭제 요청 */
.site-foot-request {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.submit-form select {
  width: 100%;
  padding: 11px 36px 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  appearance: none;
}

.submit-form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.change-kind { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.change-kind legend { width: 100%; margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 600; }
.change-kind label { display: block; }
.change-kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.change-kind span {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.change-kind input:checked + span { background: var(--text); border-color: var(--text); color: var(--bg); }
.change-kind input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.field-hint { font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.5; }

/* 관리자로 로그인한 브라우저에서만 보이는 카드 '수정' 버튼 */
.admin-edit {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}

.admin-edit:hover { background: var(--accent); color: #fff; }

.card[hidden] { display: none; }
.search-empty:not([hidden]) ~ .submit-cta { display: none; }

/* 채팅 */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .55);
  cursor: pointer;
  transition: transform .15s ease;
}

.chat-fab:hover { transform: scale(1.06); }
.chat-fab:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
.chat-fab svg { width: 26px; height: 26px; fill: currentColor; }

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e0475b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  border: 2px solid var(--bg);
}

.chat-badge[hidden] { display: none; }

.chat {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 40px));
  height: min(580px, calc(100dvh - 120px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6);
  overflow: hidden;
}

.chat[hidden] { display: none; }

.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 { margin: 0; font-size: 16px; }
.chat-online { margin-left: 4px; font-size: 12px; font-weight: 600; color: #2f9e5b; }
.chat-me { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.chat-close, .chat-picker-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--thumb);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.chat-log {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty { margin: auto; color: var(--muted); font-size: 13px; text-align: center; }

.msg { max-width: 85%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg-meta { margin: 0 0 3px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.msg.mine .msg-meta { justify-content: flex-end; }
.msg-nick { font-weight: 600; color: var(--text); }
.msg-time { opacity: .8; }

.msg-body {
  display: inline-block;
  margin: 0;
  padding: 8px 12px;
  border-radius: 14px 14px 14px 4px;
  background: var(--thumb);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.mine .msg-body { border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff; }

.msg.invite { max-width: 92%; }
.msg-invite { padding: 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 14px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); text-align: left; }
.msg-invite-text { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.msg-invite-gone { margin: 0; font-size: 13px; color: var(--muted); }

.msg-invite-site {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}

.msg-invite-site:hover { outline: 1px solid var(--accent); }
.msg-invite-site img { flex: none; width: 76px; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 7px; background: var(--thumb); }
.msg-invite-label { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.msg-invite-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-invite-go { color: var(--accent); font-weight: 700; font-size: 12px; }

.chat-status { margin: 0; padding: 6px 14px; font-size: 12px; color: var(--muted); background: var(--thumb); }
.chat-status[hidden] { display: none; }

.chat-picker {
  position: absolute;
  inset: 62px 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface);
}

.chat-picker[hidden] { display: none; }
.chat-picker-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }

.chat-picker input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.chat-picker ul { flex: 1; margin: 0; padding: 0; list-style: none; overflow-y: auto; display: grid; align-content: start; gap: 4px; }
.chat-picker li[hidden] { display: none; }

.chat-picker ul button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.chat-picker ul button:hover, .chat-picker ul button:focus-visible { background: var(--thumb); }
.chat-picker ul button.wanted { background: var(--thumb); box-shadow: inset 0 0 0 1.5px var(--accent); }
.chat-picker img, .chat-picker-noimg { flex: none; width: 64px; aspect-ratio: 1200 / 630; object-fit: cover; border-radius: 6px; background: var(--thumb); }

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.chat-form textarea {
  flex: 1;
  min-width: 0;
  max-height: 120px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
}

.chat-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

.chat-share, .chat-send {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chat-share { padding: 0 10px; }
.chat-send { width: 38px; justify-content: center; background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-share svg, .chat-send svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-send svg { fill: currentColor; stroke-width: 1.5; }

/* 모바일: 채팅창은 전체 화면 */
@media (max-width: 640px) {
  .chat-fab { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  .chat { inset: 0; width: auto; height: auto; border: 0; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); }
  body.chat-open { overflow: hidden; }
  body.chat-open .chat-fab { display: none; }
  .chat-form textarea { font-size: 16px; } /* iOS 확대 방지 */
}

/* 이용약관·개인정보처리방침 */
.site-foot-legal { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 4px; }
.site-foot-legal a { color: inherit; text-decoration: none; }
.site-foot-legal a:hover { text-decoration: underline; }

.legal-dialog { width: min(720px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); overflow: hidden; }
.legal-dialog[open] { display: flex; flex-direction: column; }
.legal-dialog > header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line);
}
.legal-body { min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 24px 28px; font-size: 14px; line-height: 1.75; }
.legal-body h3 { margin: 24px 0 6px; font-size: 15px; }
.legal-body p, .legal-body ul, .legal-body ol { margin: 0 0 8px; }
.legal-body ul, .legal-body ol { padding-left: 20px; }
.legal-body a { color: inherit; text-decoration: underline; }
.legal-date { color: var(--muted); font-size: 13px; }
.legal-contact { margin-top: 24px !important; color: var(--muted); }
.legal-table { max-width: 100%; overflow-x: auto; margin: 8px 0 4px; }
.legal-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; line-height: 1.6; }
.legal-table th, .legal-table td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal-table th { background: var(--thumb); font-weight: 600; white-space: nowrap; }

@media (max-width: 600px) {
  .legal-table table { min-width: 0; }
  .legal-table thead { display: none; }
  .legal-table tr { display: block; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .legal-table td { display: grid; grid-template-columns: 72px 1fr; gap: 8px; border: 0; border-top: 1px solid var(--line); }
  .legal-table td:first-child { border-top: 0; background: var(--thumb); font-weight: 600; }
  .legal-table td::before { content: attr(data-label); color: var(--muted); font-weight: 400; }
}

/* ── 사이트별 소개 페이지 (/s/:id) ── */
.site-page { padding-top: 40px; }
.site-page .intro-top { margin-bottom: 28px; }
.sp-back { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.sp-back:hover { color: var(--accent); }

.sp {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.sp-thumb {
  position: relative;
  aspect-ratio: 1200 / 630;
  border-radius: 18px;
  overflow: hidden;
  background: var(--thumb);
  border: 1px solid var(--line);
}
.sp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-info .eyebrow { margin-bottom: 8px; letter-spacing: .04em; text-transform: none; }
.sp-info h1 { font-size: clamp(24px, 3.4vw, 34px); }
.sp-desc { margin: 14px 0 0; color: var(--muted); font-size: 16px; }

.sp-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.sp-enter, .sp-together {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}
.sp-enter { background: var(--accent); color: #fff; }
.sp-enter:hover { filter: brightness(1.08); }
.sp-together { border: 1.5px solid var(--accent); color: var(--accent); }
.sp-together:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

.sp-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px 20px;
  margin: 28px 0 0;
  padding: 18px 0 0;
  border-top: 1px dashed var(--line);
}
.sp-meta dt { font-size: 12px; color: var(--muted); }
.sp-meta dd { margin: 2px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.sp-meta a { color: inherit; }
.sp-meta a:hover { color: var(--accent); }

.sp-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; }
.sp-tags a {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.sp-tags a:hover { color: var(--accent); border-color: var(--accent); }

.sp-section { margin-top: 56px; }
.sp-section h2 { margin: 0 0 18px; font-size: 20px; letter-spacing: -.01em; }
.sp-about { max-width: 720px; }
.sp-about p { margin: 0 0 12px; font-size: 16px; line-height: 1.8; }

.sp-similar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.sp-similar a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 8px 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: transform .2s ease, border-color .2s ease;
}
.sp-similar a:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.sp-similar-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1200 / 630;
  margin-bottom: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--thumb);
}
.sp-similar-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-similar strong { padding: 0 4px; font-size: 12px; color: var(--accent); }
.sp-similar-title {
  padding: 0 4px; font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-all { margin: 48px 0 0; text-align: center; }
.sp-all a { color: var(--accent); font-weight: 700; text-decoration: none; }

@media (max-width: 640px) {
  .sp-meta .health-text { position: static; width: auto; height: auto; clip: auto; }
}
@media (max-width: 760px) {
  .sp { grid-template-columns: 1fr; gap: 22px; }
  .sp-similar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .sp-section { margin-top: 40px; }
}
