/* 공연모아 — "갤러리 화이트"
   미술관 도록처럼: 흰 바탕, 먹색 글자, 포인트는 코발트 블루 하나.
   제목은 함렛(Hahmlet) 세리프, 본문·숫자는 Pretendard.
   무대 요소(서버 시계, 곧 오픈)만 먹색 블록으로 반전. */
:root {
  --bg: #fbfbfa;            /* 종이 */
  --card: #ffffff;
  --ink: #141414;           /* 먹색 */
  --muted: #6e6e6e;
  --line: #e7e6e3;
  --accent: #1f3bff;        /* 코발트 */
  --accent-soft: #eef0ff;
  --accent-on-dark: #8c9bff; /* 먹색 바탕 위 코발트 */
  --stage: #141414;
  --stage-ink: #f5f5f3;
  --stage-muted: #a3a3a0;
  --ok: #2b8a6e;
  --danger: #d6336c;
  --display: "Hahmlet", "Pretendard Variable", serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); background: var(--bg); color: var(--ink); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.display { font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; }

/* ---------- 헤더 ---------- */
.top { display: flex; align-items: center; gap: 28px; padding: 14px 24px; flex-wrap: wrap; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.brand .mark { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); align-self: center; }
.brand .word { font-family: var(--display); font-weight: 700; font-size: 23px; letter-spacing: -0.04em; }
.brand .beta { font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; transition: background .2s, color .2s; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--accent); color: #fff; }
.slogan { margin: 0 0 0 auto; color: var(--muted); font-size: 13px; }
.notice { background: var(--bg); color: var(--muted); font-size: 12px; padding: 7px 24px; border-bottom: 1px solid var(--line); }
.notice b { color: var(--accent); font-weight: 700; }
.notice.ok { color: var(--ok); }

/* ---------- 레이아웃 ---------- */
.view { flex: 1; min-height: 0; }
#view-events { display: grid; grid-template-columns: 440px 1fr; }
#view-events[hidden], #view-clock[hidden] { display: none; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--line); }

/* ---------- 필터 ---------- */
.filters { padding: 22px 20px 10px; display: flex; flex-direction: column; gap: 10px; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }
.panel-title { margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -0.04em; line-height: 1.2; }
.filters input[type=search], .filters select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
.filters input[type=search] { padding-left: 36px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236e6e6e' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 12px 50% no-repeat; }
.filters input:focus, .filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.row { display: flex; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 11px 5px 9px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--muted)); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip small { color: var(--muted); font-size: 11px; }
.chip.on small { color: #bdbdbd; }
.chip.fav-chip::before { display: none; }
.muted { color: var(--muted); font-size: 12px; }
#locStatus:empty { display: none; }
.count { padding: 4px 20px 10px; font-size: 12px; color: var(--muted); }

/* ---------- 곧 오픈 (먹색 블록) ---------- */
.soon { margin: 0 16px 10px; background: var(--stage); color: var(--stage-ink); border-radius: 14px; padding: 12px 14px; }
.soon h2 { font-size: 13px; font-weight: 700; color: var(--accent-on-dark); margin: 0 0 8px; }
.soon-list { display: flex; flex-direction: column; gap: 2px; }
.soon-item { text-align: left; border: 0; background: transparent; color: inherit; border-radius: 8px; padding: 7px 8px; cursor: pointer; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }
.soon-item:hover { background: rgba(255,255,255,.08); }
.soon-item b { color: var(--accent-on-dark); flex-shrink: 0; }
.soon-item small { margin-left: auto; color: var(--stage-muted); flex-shrink: 0; font-size: 12px; }

/* ---------- 목록 / 카드 ---------- */
.list { list-style: none; margin: 0; padding: 0 16px 20px; overflow-y: auto; flex: 1; }
.card {
  --notch: var(--bg);
  display: grid; grid-template-columns: 84px 1fr; gap: 0 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -16px rgba(20,20,20,.35); }
.card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.poster { width: 84px; height: 118px; object-fit: cover; border-radius: 6px; background: #ecebe8; box-shadow: 0 6px 14px -8px rgba(0,0,0,.4); grid-row: 1; }
.card:not(:has(.poster)) { grid-template-columns: 1fr; }
.card .body { min-width: 0; display: flex; flex-direction: column; }
.card .head { display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; font-weight: 700; color: #fff; padding: 2px 8px; border-radius: 999px; }
.title-link { text-decoration: none; }
.title-link:hover { color: var(--accent); }
.fav-btn { border: 0; background: none; font-size: 18px; line-height: 1; color: #b5b4b0; cursor: pointer; padding: 2px 0 2px 4px; }
.fav-btn:hover, .fav-btn.on { color: var(--accent); }
.head .tag + .fav-btn { margin-left: auto; }
.dist { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); }
.card h3 { margin: 7px 0 6px; font-family: var(--display); font-weight: 700; font-size: 18px; line-height: 1.3; letter-spacing: -0.035em; overflow-wrap: anywhere; }
.sub { font-size: 13px; color: var(--muted); line-height: 1.55; }
.sub.date { font-size: 13px; color: var(--ink); font-weight: 500; }
.clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
.price { color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.open { margin-top: 10px; font-size: 13px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.open b { white-space: nowrap; font-size: 14px; }
.open a { margin-left: auto; font-weight: 700; text-decoration: none; white-space: nowrap; }
/* 절취선: 카드 전체 폭, 양 끝에 반원 홈 */
.book {
  grid-column: 1 / -1; position: relative;
  margin: 14px -14px -14px; padding: 12px 14px;
  border-top: 1.5px dashed var(--line);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted);
}
.book::before, .book::after { content: ""; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: var(--notch); border: 1px solid var(--line); }
.book::before { left: -9px; clip-path: inset(0 0 0 50%); }
.book::after { right: -9px; clip-path: inset(0 50% 0 0); }
.book a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--ink); background: var(--card); transition: border-color .15s; }
.book a:hover { border-color: var(--ink); }
.book a.clock-link { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.book .report { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.book .report:hover { color: var(--accent); }
.more { text-align: center; padding: 6px 0 12px; }
.more button { border: 1px solid var(--ink); background: transparent; border-radius: 999px; padding: 9px 20px; cursor: pointer; font-weight: 600; }
.more button:hover { background: var(--ink); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 15px; }
.source { margin: 0; padding: 10px 20px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.6; }

/* ---------- 지도 ---------- */
#map { height: 100%; min-height: 300px; background: #efefed; }
/* 대체 지도(OpenStreetMap)일 때만: 채도를 낮춰 점이 묻히지 않게 */
.gm-osm .leaflet-tile-pane { filter: saturate(.55) contrast(.96) brightness(1.03); }
.leaflet-popup-content-wrapper { border-radius: 14px; font-family: var(--sans); box-shadow: 0 16px 40px -16px rgba(0,0,0,.45); }
.leaflet-tooltip { font-family: var(--sans); font-size: 12px; font-weight: 600; border-radius: 8px; }
.venue-popup .leaflet-popup-content { margin: 0; width: 280px !important; }

/* 카카오맵 점 (CustomOverlay) */
.gm-dot { position: relative; box-sizing: border-box; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); cursor: pointer; transition: transform .12s; }
.gm-dot:hover { transform: scale(1.15); z-index: 3; }
.gm-dot.on { border: 4px solid var(--accent); transform: scale(1.25); box-shadow: 0 0 0 4px rgba(31,59,255,.18), 0 2px 8px rgba(0,0,0,.4); }
.gm-dot[data-label]:hover::after {
  content: attr(data-label); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font: 600 12px/1.3 var(--sans); padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none;
}
/* 카카오맵 말풍선 */
.gm-popup { position: relative; width: 280px; margin-bottom: 20px; background: #fff; border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.45); font-family: var(--sans); color: var(--ink); text-align: left; }
.gm-popup::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 16px; height: 16px; background: #fff; transform: translateX(-50%) rotate(45deg); box-shadow: 3px 3px 6px -3px rgba(0,0,0,.2); }
.gm-close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer; z-index: 2; }
.gm-close:hover { background: var(--bg); color: var(--ink); }

/* 공연장 말풍선 내용 (카카오·OSM 공통) */
.pop-venue { padding-right: 32px; }
.pop-venue { padding: 12px 14px 10px; font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -0.03em; border-bottom: 1px solid var(--line); }
.pop-venue small { display: block; font-family: var(--sans); font-weight: 400; font-size: 11px; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.pop ul { list-style: none; margin: 0; padding: 6px; max-height: 300px; overflow-y: auto; }
.pop-item { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.pop-item:hover { background: var(--bg); }
.pop-item.on { background: var(--accent-soft); }
.pop-item img, .pop-ph { width: 44px; height: 62px; object-fit: cover; border-radius: 4px; background: #ecebe8; display: block; }
.pop-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pop-tag { font-size: 10px; font-weight: 700; }
.pop-body b { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pop-body small { font-size: 11px; color: var(--muted); }
.pop a.pop-go { margin-top: 4px; align-self: flex-start; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 4px 10px; text-decoration: none; }
.pop a.pop-go:hover { background: var(--ink); }
.pop-more { display: block; width: calc(100% - 12px); margin: 0 6px 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pop-more:hover { border-color: var(--ink); }
.sub.cast { color: var(--ink); }

/* ---------- 서버 시계 (먹색 무대) ---------- */
#view-clock { overflow-y: auto; background: var(--bg); }
.clock-wrap { max-width: 980px; margin: 0 auto; padding: 28px 20px 48px; }
.clock-main { background: var(--stage); color: var(--stage-ink); border-radius: 22px; padding: 28px 24px 26px; text-align: center; }
.pick { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.pick button { background: transparent; border: 1px solid rgba(255,255,255,.2); color: var(--stage-muted); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 13px; }
.pick button:hover { border-color: #fff; color: #fff; }
.pick button.on { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.big { font-size: clamp(56px, 12vw, 128px); font-weight: 700; letter-spacing: -0.03em; margin: 16px 0 2px; }
.big small { font-size: .45em; color: var(--accent-on-dark); letter-spacing: 0; }
.meta { color: var(--stage-muted); font-size: 13px; min-height: 20px; }
.actions { display: flex; justify-content: center; gap: 16px; align-items: center; margin-top: 16px; font-size: 14px; }
.actions button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.actions button:hover { background: #fff; color: var(--stage); }
.check { color: var(--stage-muted); display: inline-flex; gap: 6px; align-items: center; }
.check input { accent-color: var(--accent); }
.check.alarm { margin-top: 14px; flex-wrap: wrap; color: var(--stage-ink); font-weight: 600; }
.check.alarm small { color: var(--stage-muted); font-weight: 400; }
#alarmMsg { font-size: 13px; margin-top: 6px; color: var(--stage-muted); }
.target { margin-top: 22px; padding-top: 20px; border-top: 1px dashed rgba(255,255,255,.18); font-size: 14px; color: var(--stage-muted); }
.target input { background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 7px 10px; margin-left: 6px; color-scheme: dark; }
.target .muted { color: var(--stage-ink); margin-top: 8px; font-family: var(--display); font-size: 16px; font-weight: 700; }
.countdown { font-size: 30px; font-weight: 700; margin-top: 8px; min-height: 36px; }
.countdown.hot { color: var(--accent-on-dark); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.grid-title { font-family: var(--display); font-weight: 700; font-size: 21px; margin: 32px 0 12px; letter-spacing: -0.03em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile.std { background: var(--accent-soft); border-color: #d6dbff; }
.tile .n { font-weight: 700; font-size: 14px; }
.tile .n small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.tile .t { font-size: 28px; font-weight: 700; margin: 8px 0 4px; letter-spacing: -0.02em; }
.tile .d { font-size: 12px; color: var(--muted); }
.tile .err { color: var(--danger); }
.fine { color: var(--muted); font-size: 12px; line-height: 1.7; margin-top: 24px; max-width: 70ch; }

/* ---------- 제보 다이얼로그 ---------- */
.report-dialog { border: 0; border-radius: 18px; padding: 0; width: min(440px, 92vw); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); color: var(--ink); }
.report-dialog::backdrop { background: rgba(20,20,20,.45); backdrop-filter: blur(3px); }
.report-dialog form { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.report-dialog h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.report-dialog #reportTitle { margin: -6px 0 4px; font-size: 13px; }
.report-dialog label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.report-dialog input, .report-dialog select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font-weight: 400; background: #fff; }
.report-dialog input:focus, .report-dialog select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-actions button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 18px; cursor: pointer; }
.form-actions .primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.form-actions .primary:disabled { opacity: .5; cursor: default; }
.form-msg { font-size: 13px; }
.form-msg.ok { color: var(--ok); } .form-msg.err { color: var(--danger); }

/* 세로가 짧은 화면: 제목을 숨겨 목록 공간 확보 */
@media (min-width: 821px) and (max-height: 820px) {
  .eyebrow, .panel-title { display: none; }
  .filters { padding-top: 14px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .tile { transition: none; }
  .card:hover, .tile:hover { transform: none; }
  .countdown.hot { animation: none; }
}

/* ---------- 휴대폰 ---------- */
@media (max-width: 820px) {
  html, body { height: auto; }
  body { display: block; }
  /* 휴대폰: 지도를 위에 고정하고 목록이 그 아래로 스크롤 — 카드를 누르면 바로 위 지도에서 말풍선이 열림 */
  #view-events { display: flex; flex-direction: column; }
  #map { order: -1; position: sticky; top: 0; z-index: 20; height: 38vh; min-height: 240px; border-bottom: 1px solid var(--line); }
  .gm-popup { width: 260px; }
  .pop ul { max-height: 170px; }
  .panel { border-right: 0; }
  .list { overflow: visible; padding: 0 12px 20px; }
  .slogan { display: none; }
  .top { gap: 12px; padding: 12px 16px; }
  .notice { padding: 7px 16px; }
  .filters { padding: 18px 16px 10px; }
  .panel-title { font-size: 24px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .chip { flex-shrink: 0; }
  .card { grid-template-columns: 72px 1fr; }
  .poster { width: 72px; height: 101px; }
  /* 메뉴가 두 줄로 쪼개지지 않게: 한 줄 가로 스크롤 */
  .top { flex-wrap: wrap; row-gap: 8px; }
  .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; gap: 2px; margin: 0 -4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; flex-shrink: 0; padding: 6px 12px; font-size: 13.5px; }
  /* 목록을 볼 공간 확보 */
  #map { height: 30vh; min-height: 200px; }
}
#openPick { display: block; width: 100%; max-width: 460px; margin-bottom: 12px; padding: 9px 10px; border-radius: 8px; background: rgba(255,255,255,.06); color: #fff; border: 1px solid rgba(255,255,255,.2); font: inherit; color-scheme: dark; }
#openPick[hidden] { display: none; }
