:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --text: #17181a;
  --muted: #6a6d73;
  --line: #e3e3de;
  --line-strong: #c9c9c2;
  --deal: #d6300f;        /* 할인율 숫자 */
  --deal-soft: #fdece7;
  --ink: #17181a;         /* 주 버튼 */
  --on-ink: #ffffff;
  --open: #16794a;
  --open-soft: #e2f3ea;
  --soon: #a55300;
  --soon-soft: #fbefdf;
  --news: #6a5b00;
  --news-soft: #f6f0c9;
  --base: 17px;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315; --card: #1b1c1f; --text: #ececee; --muted: #a2a5ab; --line: #2c2e33; --line-strong: #3d4047;
    --deal: #ff7a5c; --deal-soft: #3a1f19; --ink: #ececee; --on-ink: #121315;
    --open: #5fd394; --open-soft: #17301f; --soon: #f0a656; --soon-soft: #36270f; --news: #e3d26b; --news-soft: #333015;
    color-scheme: dark;
  }
}
html.big { --base: 21px; }

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--base)/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  word-break: keep-all; -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
.num { font-variant-numeric: tabular-nums; }

/* 머리 */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { font-weight: 800; font-size: 1.15em; text-decoration: none; letter-spacing: -0.02em; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--deal); margin-right: 8px; vertical-align: 1px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 700; font-size: 0.92em; }
.nav a[aria-current="page"] { color: var(--text); background: var(--bg); }
.text-size { font: inherit; font-size: 0.8em; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }

h1 { font-size: 1.45em; line-height: 1.3; margin: 28px 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 1.1em; margin: 32px 0 10px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 0.92em; }
.crumb { color: var(--muted); font-size: 0.85em; margin-top: 20px; }
.crumb a { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 32px 0 10px; }
.section-head h2 { margin: 0; }
.section-head a { color: var(--muted); font-size: 0.88em; }

/* 버튼·칩 */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 8px; font: inherit; font-size: 0.88em; font-weight: 700; text-decoration: none; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 0.85em; font-weight: 700; padding: 8px 14px; min-height: 40px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
select { font: inherit; font-size: 0.9em; min-height: 40px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); }
select:focus, .btn:focus-visible, .seg button:focus-visible { outline: 3px solid var(--deal); outline-offset: 1px; }

/* 꼬리표 */
.tag { display: inline-block; font-size: 0.75em; font-weight: 800; padding: 2px 8px; border-radius: 5px; line-height: 1.5; white-space: nowrap; }
.tag.open { background: var(--open-soft); color: var(--open); }
.tag.upcoming { background: var(--soon-soft); color: var(--soon); }
.tag.closed { background: var(--bg); color: var(--muted); }
.tag.kind { background: var(--bg); color: var(--text); font-weight: 700; }
.tag.news { background: var(--news-soft); color: var(--news); font-weight: 700; }
.tag.deal { background: var(--deal-soft); color: var(--deal); }

/* 비교표 */
.cmp { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 0.92em; }
.cmp th { text-align: left; font-size: 0.8em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.cmp td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp tr:last-child td { border-bottom: 0; }
.cmp .name a { font-weight: 800; text-decoration: none; }
.cmp .name a:hover { text-decoration: underline; }
.cmp .region { display: block; color: var(--muted); font-size: 0.85em; }
.cmp .rate { font-weight: 900; font-size: 1.35em; color: var(--deal); white-space: nowrap; line-height: 1.2; }
.cmp .rate small { font-size: 0.6em; font-weight: 700; }
.cmp .rate.none { font-size: 0.9em; color: var(--muted); font-weight: 700; }
.cmp .now .tag { margin: 0 4px 4px 0; }
.cmp .asof { color: var(--muted); white-space: nowrap; font-size: 0.85em; }
.cmp .limit { white-space: nowrap; }
.cmp .asof a { color: var(--muted); }
.cmp tr.stale .rate, .cmp tr.stale .limit { opacity: 0.55; }
.cmp tr.stale .asof { color: var(--soon); font-weight: 700; }
.cmp .mnote { display: block; color: var(--muted); font-size: 0.82em; }
.legend { color: var(--muted); font-size: 0.82em; margin: 8px 0 0; }

@media (max-width: 640px) {
  .cmp, .cmp tbody { display: block; }
  .cmp thead { display: none; }
  .cmp tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name rate" "meta meta" "now now"; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .cmp tr:last-child { border-bottom: 0; }
  .cmp td { padding: 0; border: 0; }
  .cmp td.name { grid-area: name; }
  .cmp td.rate { grid-area: rate; text-align: right; }
  .cmp td.meta-m { grid-area: meta; color: var(--muted); font-size: 0.85em; }
  .cmp td.now { grid-area: now; margin-top: 6px; }
  .cmp td.now:empty { display: none; }
  .cmp .desk { display: none; }
}
@media (min-width: 641px) { .cmp .meta-m { display: none; } }

/* 다가오는 일정(짧은 줄) */
.agenda { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.agenda li { display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.agenda li:last-child { border-bottom: 0; }
.agenda .d { font-weight: 800; font-variant-numeric: tabular-nums; }
.agenda .d small { display: block; color: var(--muted); font-weight: 600; font-size: 0.75em; }
.agenda a { text-decoration: none; font-weight: 700; }
.agenda .v { display: block; color: var(--muted); font-size: 0.82em; font-weight: 400; }

/* 행사 카드 */
.event { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.event.closed { opacity: 0.6; }
.event-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.event-top .v { color: var(--muted); font-size: 0.82em; text-decoration: none; margin-left: auto; }
.event h3 { margin: 0 0 4px; font-size: 1.05em; line-height: 1.4; }
.when { font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.benefit { color: var(--deal); font-weight: 800; margin: 2px 0; }
.meta { margin: 2px 0; color: var(--muted); font-size: 0.92em; }
.meta b { color: var(--text); font-weight: 700; margin-right: 4px; }
.note { margin: 8px 0 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 0.88em; color: var(--muted); }
.empty { color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; font-size: 0.92em; }
details.past { margin: 10px 0; }
details.past summary { cursor: pointer; color: var(--muted); font-weight: 700; padding: 10px 0; font-size: 0.9em; }

/* 상품권 요약 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0; }
.stats div { padding: 12px 14px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats dt { color: var(--muted); font-size: 0.78em; font-weight: 700; }
.stats dd { margin: 2px 0 0; font-weight: 800; }
.stats dd.rate { color: var(--deal); font-size: 1.5em; line-height: 1.2; }
.stats .stale { color: var(--soon); }
.about { color: var(--muted); margin: 0 0 8px; }
.facts, .tips { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 32px; margin: 0; font-size: 0.94em; }
.facts li, .tips li { margin: 6px 0; }
.src { color: var(--muted); font-size: 0.82em; margin-left: 4px; }

/* 구독 */
.subscribe { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--deal); border-radius: var(--radius); padding: 14px 16px; margin: 28px 0; }
.subscribe p { margin: 0; font-size: 0.92em; color: var(--muted); }
.subscribe b { color: var(--text); font-size: 1.05em; }

/* 링크 격자 */
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.links a { display: block; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 4px; text-decoration: none; font-weight: 700; font-size: 0.9em; }
.links.wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.links.wide a { text-align: left; padding: 11px 14px; }
.links span { color: var(--muted); font-weight: 400; font-size: 0.85em; margin-left: 4px; }

/* 달력 */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 10px; flex-wrap: wrap; }
.cal-head .month { font-size: 1.2em; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 8em; text-align: center; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav button { font: inherit; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); cursor: pointer; font-weight: 800; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cal .dow { background: var(--bg); text-align: center; font-size: 0.78em; font-weight: 700; color: var(--muted); padding: 6px 0; }
.cal .dow.sun, .cal .day.sun .n { color: var(--deal); }
.cal .day { background: var(--card); min-height: 92px; padding: 4px; text-align: left; font: inherit; border: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.cal .day.out { background: var(--bg); color: var(--muted); }
.cal .day .n { font-size: 0.82em; font-weight: 700; font-variant-numeric: tabular-nums; padding: 2px 4px; align-self: flex-start; border-radius: 6px; }
.cal .day.today .n { background: var(--ink); color: var(--on-ink); }
.cal .day[aria-pressed="true"] { outline: 2px solid var(--deal); outline-offset: -2px; }
.cal .chip { display: block; font-size: 0.7em; font-weight: 700; line-height: 1.3; padding: 2px 4px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal .chip.sale, .cal .chip.discount { background: var(--deal-soft); color: var(--deal); }
.cal .chip.payback { background: var(--open-soft); color: var(--open); }
.cal .chip.deadline, .cal .chip.end { background: var(--soon-soft); color: var(--soon); }
.cal .more { font-size: 0.7em; color: var(--muted); padding: 0 4px; }
.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.8em; color: var(--muted); margin: 8px 0 0; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 640px) {
  .cal .day { min-height: 62px; padding: 2px; }
  .cal .chip { font-size: 0; height: 6px; padding: 0; }
  .cal .more { display: none; }
}

.warn { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; font-size: 0.9em; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 10px; font-size: 0.9em; transition: 0.2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.ad-slot { margin: 24px 0; min-height: 100px; }
.ad-slot:empty { display: none; }
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--card); }
.site-footer p { color: var(--muted); font-size: 0.8em; margin: 12px 0; }

@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; gap: 0 12px; padding-top: 8px; }
  .nav { order: 3; flex-basis: 100%; margin: 4px -12px 0; overflow-x: auto; }
  .text-size { margin-left: auto; }
  .site-header { position: static; }
}
@media print {
  .site-header, .actions, .ad-slot, .site-footer, .subscribe, .controls { display: none !important; }
  body { background: #fff; color: #000; }
}

/* 문화상품권 특가 표 */
.deals .name a { font-weight: 700; }
@media (max-width: 640px) {
  .cmp.deals tr { grid-template-areas: "name rate" "date now"; }
  .cmp.deals td.asof { grid-area: date; display: block; }
  .cmp.deals td.now { grid-area: now; margin: 0; text-align: right; }
}

/* 지역 검색 */
.search { position: relative; margin: 0 0 14px; }
.search input { font: inherit; width: 100%; min-height: 52px; padding: 10px 16px; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--card); color: var(--text); }
.search input:focus { outline: 3px solid var(--deal); outline-offset: 1px; }
.search-results { list-style: none; margin: 6px 0 0; padding: 0; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.search-results li + li { border-top: 1px solid var(--line); }
.search-results a { display: grid; grid-template-columns: minmax(90px, auto) 1fr auto; gap: 10px; align-items: baseline; padding: 12px 14px; text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--bg); }
.search-results .where { color: var(--muted); font-size: 0.88em; }
.search-results .rate { color: var(--deal); font-weight: 800; font-size: 0.9em; }
.search-results .none { padding: 12px 14px; color: var(--muted); font-size: 0.92em; }
.cmp tr[hidden] { display: none; }
.linklike { font: inherit; font-weight: 800; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.linklike:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.section-head .linklike { font-size: 0.85em; font-weight: 700; color: var(--muted); }
.cmp.brands tr.on { background: var(--deal-soft); }
