:root {
  --bg: #f6f7fb; --card: #fff; --ink: #1f2430; --muted: #6b7280; --line: #e5e7ef;
  --shadow: 0 6px 20px rgba(20, 30, 60, .08);
  --ok: #20bf6b; --mid: #f7b731; --busy: #fa8231; --full: #eb3b5a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif; }
body.lock { overflow: hidden; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
button { font: inherit; cursor: pointer; color: inherit; }
a { color: inherit; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo { width: 40px; height: 40px; border-radius: 10px; }
.pill.install { background: #ff7a6b; color: #fff; border-color: #ff7a6b; font-weight: 700; }
h1 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.date-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-box label { font-size: 13px; color: var(--muted); }
.date-box input { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: inherit; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.pill:hover { border-color: var(--ink); }
.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.status { font-size: 12px; color: var(--muted); padding-bottom: 8px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge-src { padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.badge-src.live { background: #e6f9ef; color: #0f8a4a; }
.badge-src.base { background: #fff4e0; color: #b46b00; }
.status button { border: 0; background: none; color: #2563eb; padding: 0; font-size: 12px; }

/* 지역 배너 */
.region-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 22px; }
.rtile { border: 0; border-radius: 20px; padding: 18px; color: #fff; text-align: left; box-shadow: var(--shadow); transition: transform .15s, opacity .15s; position: relative; overflow: hidden; min-height: 160px; }
.rtile:hover { transform: translateY(-3px); }
.rtile .re { position: absolute; right: 10px; top: 8px; font-size: 46px; opacity: .45; }
.rtile h4 { margin: 0 0 10px; font-size: 20px; }
.rtile .rs { font-size: 12.5px; line-height: 1.8; }
.rtile .rs i { font-style: normal; background: rgba(255,255,255,.25); padding: 1px 7px; border-radius: 6px; margin-right: 4px; }
.home-hint { text-align: center; color: var(--muted); margin: 26px 0 10px; }
/* 지역 선택 후: 배너를 한 줄로 */
.region-grid.compact { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-top: 16px; }
.region-grid.compact .rtile { min-height: 0; padding: 9px 14px; border-radius: 12px; flex: 0 0 auto; opacity: .55; }
.region-grid.compact .rtile.on { opacity: 1; outline: 3px solid var(--ink); outline-offset: 2px; }
.region-grid.compact .rtile h4 { margin: 0; font-size: 14px; white-space: nowrap; }
.region-grid.compact .rtile .re, .region-grid.compact .rtile .rs { display: none; }

/* 지역 상세 */
.rbanner { margin-top: 18px; border-radius: 20px; padding: 20px 24px; color: #fff; box-shadow: var(--shadow); }
.rbanner .back { background: rgba(255,255,255,.22); border: 0; border-radius: 999px; padding: 5px 12px; font-size: 13px; color: #fff; }
.rbanner h2 { margin: 10px 0 4px; font-size: 26px; }
.rbanner p { margin: 0; opacity: .95; font-size: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 16px 0 6px; flex-wrap: wrap; }
.toolbar .filters { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding-bottom: 4px; }
.toolbar select { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; background: #fff; }
.list-title { font-size: 16px; margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.list-title small { color: var(--muted); font-weight: 400; font-size: 13px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; width: 100%; background: var(--card); border: 1px solid transparent; border-radius: 16px; padding: 10px; text-align: left; box-shadow: 0 2px 8px rgba(20,30,60,.05); transition: border-color .15s, transform .15s; }
.item:hover { border-color: #c9cede; transform: translateX(2px); }
.thumb { flex: 0 0 112px; height: 84px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 38px; overflow: hidden; background-size: cover; background-position: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item .t { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item .t b { font-size: 16px; letter-spacing: -.3px; }
.item .m { font-size: 12.5px; color: var(--muted); }
.item .d { font-size: 13px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12px; }
.item .chev { color: #b0b5c3; font-size: 20px; }
.crowd-pill { padding: 3px 9px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 11.5px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: #f1f2f6; color: var(--ink); white-space: nowrap; }
.tag.now { background: #ff4757; color: #fff; }
.tag.soon { background: #ffa502; color: #fff; }
.tag.kid { background: #7bed9f; color: #14532d; }
.tag.indoor { background: #dfe4ea; color: #2f3542; }
.tag.gem { background: #f3e8ff; color: #7e22ce; }
.tag.est { background: #f1f2f6; color: #57606f; font-weight: 500; }
.tag.ok { background: #e6f9ef; color: #0f8a4a; }

/* 상세 모달 */
.modal { position: fixed; inset: 0; background: rgba(15, 20, 35, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 16px; }
.modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 22px; width: 100%; max-width: 760px; position: relative; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.close { position: absolute; right: 14px; top: 14px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); font-size: 18px; box-shadow: var(--shadow); }
.gallery { position: relative; height: 340px; background: #222; display: flex; align-items: center; justify-content: center; font-size: 110px; color: #fff; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .gnav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 22px; }
.gallery .gprev { left: 12px; } .gallery .gnext { right: 12px; }
.gallery .gcount { position: absolute; right: 14px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 999px; }
.detail { padding: 22px 26px 26px; }
.detail h2 { margin: 0 0 6px; font-size: 25px; letter-spacing: -.6px; }
.detail .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.detail .meta { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.detail .lead { font-size: 15.5px; line-height: 1.6; margin: 0 0 10px; }
.detail .overview { font-size: 13.5px; line-height: 1.75; color: #4b5563; background: #f8f9fc; border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; white-space: pre-line; }
.boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.box { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.box h4 { margin: 0 0 8px; font-size: 14.5px; }
.box ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.75; }
.box p { margin: 0; font-size: 13.5px; line-height: 1.7; white-space: pre-line; }
.box.wide { grid-column: 1 / -1; }
.features { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.features span { background: #fff7e6; color: #8a5300; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.info-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; font-size: 13.5px; line-height: 1.55; }
.info-dl dt { color: var(--muted); white-space: nowrap; }
.info-dl dd { margin: 0; }
.box .note { margin-top: 8px; font-size: 11.5px; color: #9aa0ad; }
.ref { list-style: none; padding: 0 !important; }
.ref a { color: #2563eb; text-decoration: none; }
.ref a:hover { text-decoration: underline; }
.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.links a { font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }
.links a:hover { border-color: var(--ink); }
.links a.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.credit { margin-top: 14px; font-size: 11.5px; color: #9aa0ad; }

.foot { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 34px 0 50px; }

.m-crowd { display: none; font-weight: 600; }
.src-note { color: #9aa0ad; }
/* 지역 선택 후 지역 줄은 스크롤해도 위에 고정 */
.region-grid.compact { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 10px 0 8px; margin-top: 8px; }
.toolbar .filters, .region-grid.compact { scrollbar-width: none; }
.toolbar .filters::-webkit-scrollbar, .region-grid.compact::-webkit-scrollbar { display: none; }
@media (hover: none) { .item:hover, .rtile:hover { transform: none; } }
body { padding-bottom: env(safe-area-inset-bottom); }

@media (max-width: 900px) { .region-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  /* 헤더를 얇게 */
  .top-inner { padding-top: 10px; padding-bottom: 6px; gap: 8px; }
  .logo { width: 32px; height: 32px; border-radius: 8px; }
  .top-inner { padding-top: calc(10px + env(safe-area-inset-top)); position: relative; }
  .pill.install { position: absolute; right: 16px; top: calc(12px + env(safe-area-inset-top)); padding: 6px 12px; }
  h1 { font-size: 18px; }
  .sub { display: none; }
  .date-box { width: 100%; gap: 6px; flex-wrap: nowrap; }
  .date-box label { display: none; }
  .date-box input { flex: 1; min-width: 0; padding: 8px 10px; }
  .date-box .pill { padding: 8px 12px; }
  .status { font-size: 11.5px; gap: 6px; padding-bottom: 6px; }
  .src-note { display: none; }

  /* 지역 배너 2열 */
  .region-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
  .rtile { min-height: 128px; padding: 14px; border-radius: 16px; }
  .rtile h4 { font-size: 17px; margin-bottom: 8px; }
  .rtile .re { font-size: 34px; }
  .rtile .rs { font-size: 11.5px; line-height: 1.75; }
  .home-hint { font-size: 14px; }

  /* 지역 상세 */
  .rbanner { margin-top: 10px; padding: 14px 16px; border-radius: 16px; }
  .rbanner h2 { font-size: 21px; margin: 8px 0 2px; }
  .rbanner p { font-size: 12.5px; }
  .toolbar { margin-top: 12px; }
  .toolbar .filters { flex-basis: 100%; margin: 0 -16px; padding: 0 16px 4px; }
  .toolbar .pill { padding: 8px 13px; }
  .toolbar select { margin-left: auto; padding: 7px 10px; }
  .list-title { font-size: 15px; margin-top: 18px; }
  .list { gap: 8px; }
  .item { padding: 8px; gap: 10px; border-radius: 14px; align-items: flex-start; }
  .thumb { flex-basis: 88px; height: 88px; border-radius: 10px; font-size: 32px; }
  .item .t b { font-size: 15px; width: 100%; }
  .item .d { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12.5px; }
  .item .side { display: none; }
  .m-crowd { display: inline; }
  .tag { font-size: 10.5px; }

  /* 상세 화면: 전체 화면 */
  .modal { padding: 0; }
  .sheet { border-radius: 0; min-height: 100%; max-width: none; }
  .close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .gallery { height: 62vw; max-height: 320px; font-size: 80px; }
  .gallery .gnav { display: none; }
  .detail { padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); }
  .detail h2 { font-size: 21px; }
  .detail .lead { font-size: 14.5px; }
  .detail .overview { font-size: 13px; }
  .boxes { grid-template-columns: 1fr; gap: 10px; }
  .info-dl { grid-template-columns: 1fr; gap: 2px; }
  .info-dl dd { margin-bottom: 6px; }
  .links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .links a { text-align: center; padding: 11px 8px; font-size: 13.5px; }
  .links a.primary { grid-column: 1 / -1; }
  .foot { font-size: 11.5px; }
}
