:root {
  --ink: #171817;
  --muted: #686c68;
  --line: #dfe2de;
  --surface: #ffffff;
  --soft: #f4f6f3;
  --green: #215f48;
  --green-soft: #e7f2ec;
  --blue: #285ba5;
  --blue-soft: #eaf0fa;
  --coral: #b84b37;
  --coral-soft: #faece8;
  --yellow: #855f0c;
  --yellow-soft: #fbf2d3;
  --rail: 72px;
  --header: 72px;
  color: var(--ink);
  background: #f8f9f7;
  font-family: Pretendard, "Noto Sans KR", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { min-height: 100vh; margin: 0; background: #f8f9f7; }
button, input, select { font: inherit; }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { text-decoration: none; }
[hidden] { display: none !important; }
.mobile-only { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.side-rail { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 16px 0; border-right: 1px solid var(--line); background: #fff; }
.rail-nav { display: flex; flex: 1; flex-direction: column; gap: 10px; }
.rail-button, .icon-button { position: relative; display: grid; width: 42px; height: 42px; place-items: center; border: 0; border-radius: 50%; background: transparent; }
.rail-button:hover, .rail-button:focus-visible, .icon-button:hover, .icon-button:focus-visible { outline: 0; background: var(--soft); }
.rail-button[data-tooltip]::after { position: absolute; left: 52px; z-index: 50; padding: 7px 9px; border-radius: 4px; color: #fff; background: #202220; content: attr(data-tooltip); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-3px); transition: 120ms ease; }
.rail-button:hover::after, .rail-button:focus-visible::after { opacity: 1; transform: translateX(0); }
.site-column { min-height: 100vh; margin-left: var(--rail); }

.search-header { position: sticky; top: 0; z-index: 20; height: var(--header); display: grid; grid-template-columns: 150px minmax(320px, 720px) 150px; gap: 22px; align-items: center; justify-content: center; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.wordmark { font-size: 21px; font-weight: 900; }
.search-form { display: grid; width: 100%; min-width: 0; grid-template-columns: minmax(0,1fr) 48px; height: 48px; overflow: hidden; border: 1px solid #b9bdb8; border-radius: 8px; background: #fff; }
.search-form:focus-within { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(23,24,23,.08); }
.search-form input { min-width: 0; padding: 0 16px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search-form button { border: 0; background: transparent; font-size: 22px; }
.search-form button:hover { background: var(--soft); }
.header-actions { display: flex; justify-content: flex-end; gap: 8px; }
.profile-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: #e7e9e6; font-weight: 800; }

.search-main { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 90px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 0; }
.page-heading { max-width: 760px; margin: 18px 0 28px; }
.page-heading h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.2; }
.page-heading p { margin: 12px 0 0; color: var(--muted); line-height: 1.65; }
.page-heading--search { margin-top: 7vh; }

.query-examples { display: grid; max-width: 820px; border-top: 1px solid var(--line); }
.query-examples button { display: flex; align-items: center; justify-content: space-between; padding: 18px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; font-size: 17px; text-align: left; }
.query-examples button:hover { padding-right: 12px; color: var(--green); }
.before-categories { margin-top: 58px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title h2 { margin: 0; font-size: 22px; }
.section-title button { border: 0; background: transparent; font-weight: 800; }
.category-shortcuts { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.category-shortcut { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; }
.category-shortcut span { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 6px; background: var(--soft); font-size: 20px; }
.category-shortcut strong { font-size: 14px; }

.category-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.category-card { min-height: 170px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; }
.category-card:hover { border-color: #9ba09a; transform: translateY(-2px); }
.category-card__icon { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 8px; font-size: 24px; }
.category-card:nth-child(4n+1) .category-card__icon { color: var(--green); background: var(--green-soft); }
.category-card:nth-child(4n+2) .category-card__icon { color: var(--blue); background: var(--blue-soft); }
.category-card:nth-child(4n+3) .category-card__icon { color: var(--coral); background: var(--coral-soft); }
.category-card:nth-child(4n) .category-card__icon { color: var(--yellow); background: var(--yellow-soft); }
.category-card strong { display: block; margin-top: 20px; font-size: 18px; }
.category-card small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; }

.interpreted-conditions { display: flex; gap: 7px; min-height: 34px; margin-bottom: 22px; overflow-x: auto; }
.condition-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 9px 0 11px; border: 1px solid #cdd1cc; border-radius: 16px; background: #fff; font-size: 12px; }
.condition-chip em { color: var(--muted); font-style: normal; }
.condition-chip button { width: 18px; height: 18px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: var(--muted); background: var(--soft); }
.condition-note { flex: 0 0 auto; align-self: center; color: var(--muted); font-size: 11px; }

.result-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.result-heading h1 { margin: 0; font-size: 32px; }
.result-heading h1 b { color: var(--muted); font-size: 16px; }
.result-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.result-types { display: flex; gap: 22px; margin-top: 25px; border-bottom: 1px solid var(--line); }
.result-types button { position: relative; padding: 0 2px 13px; border: 0; color: var(--muted); background: transparent; font-weight: 800; }
.result-types button.is-active { color: var(--ink); }
.result-types button.is-active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--ink); content: ""; }
.result-types b { color: inherit; font-size: 11px; }

.filter-bar { position: sticky; top: var(--header); z-index: 12; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); background: rgba(248,249,247,.96); }
.filter-buttons { display: flex; min-width: 0; flex: 1 1 auto; gap: 7px; padding-bottom: 2px; overflow-x: auto; }
.filter-buttons button { flex: 0 0 auto; min-height: 44px; padding: 0 13px; border: 1px solid #ced2cd; border-radius: 6px; background: #fff; font-size: 12px; line-height: 1; }
.filter-buttons button.is-applied { border-color: var(--green); color: var(--green); background: var(--green-soft); font-weight: 800; }
.sort-select { flex: 0 0 auto; }
.sort-select select { height: 44px; padding: 0 28px 0 10px; border: 0; outline: 0; background: transparent; font-size: 12px; font-weight: 800; }

.exact-host { display: grid; grid-template-columns: 74px minmax(0,1fr) auto; gap: 16px; align-items: center; margin-top: 24px; padding: 18px; border: 1px solid #b8cbbf; border-radius: 8px; background: #fff; }
.exact-host img { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; }
.exact-host h2 { margin: 0; font-size: 20px; }
.exact-host p { margin: 6px 0 9px; color: var(--muted); font-size: 13px; }
.exact-host__tags { display: flex; gap: 6px; }
.exact-host__tags span { padding: 4px 7px; border-radius: 4px; background: var(--soft); font-size: 11px; }

.result-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 28px 18px; margin-top: 26px; }
.program-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.program-card__media { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #e8eae7; }
.program-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 180ms ease; }
.program-card:hover .program-card__media img { transform: scale(1.025); }
.save-button { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; box-shadow: 0 4px 14px rgba(0,0,0,.15); background: rgba(255,255,255,.94); font-size: 18px; }
.save-button.is-saved { color: var(--coral); }
.program-card__body { padding: 15px 15px 13px; }
.card-category { color: var(--green); font-size: 10px; font-weight: 900; }
.program-card h2 { display: -webkit-box; min-height: 45px; margin: 7px 0 6px; overflow: hidden; font-size: 18px; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-host { margin: 0; color: var(--muted); font-size: 12px; }
.card-description { display: -webkit-box; min-height: 38px; margin: 10px 0; overflow: hidden; color: #555954; font-size: 12px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-tags { display: flex; gap: 5px; overflow: hidden; }
.card-tags span { flex: 0 0 auto; padding: 4px 6px; border-radius: 4px; background: var(--soft); color: #555954; font-size: 10px; }
.gathering-match { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.gathering-match > span { display: block; margin-bottom: 5px; color: var(--blue); font-size: 10px; font-weight: 900; }
.gathering-match strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.gathering-match p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.gathering-match a { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 900; text-decoration: underline; }
.search-reason { min-height: 43px; margin: 0; padding: 11px 15px; border-top: 1px solid var(--line); color: #3f5148; background: var(--green-soft); font-size: 11px; line-height: 1.45; }
.no-schedule { margin-top: 13px; padding: 11px 0 0; border-top: 1px solid var(--line); }
.no-schedule strong { display: block; font-size: 12px; }
.no-schedule p { margin: 5px 0 9px; color: var(--muted); font-size: 11px; }
.no-schedule button { padding: 0; border: 0; background: transparent; font-size: 11px; font-weight: 900; text-decoration: underline; }

.result-empty { max-width: 620px; margin: 80px auto 0; text-align: center; }
.result-empty > span { display: grid; width: 54px; height: 54px; place-items: center; margin: 0 auto 17px; border-radius: 50%; color: var(--muted); background: #e8eae7; font-size: 24px; }
.result-empty h2 { margin: 0 0 9px; font-size: 24px; }
.result-empty p { margin: 0 auto 22px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.empty-actions { display: flex; justify-content: center; gap: 8px; }
.primary-button, .secondary-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid var(--ink); border-radius: 6px; font-size: 13px; font-weight: 900; }
.primary-button { color: #fff; background: var(--ink); }
.secondary-button { background: #fff; }
.result-loader { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 100px; color: var(--muted); font-size: 12px; }
.result-loader span { width: 22px; height: 22px; border: 2px solid #cbd0ca; border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.result-end { padding: 50px 0 10px; text-align: center; }
.result-end p { color: var(--muted); font-size: 12px; }
#scroll-sentinel { height: 2px; }

.skeleton-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.skeleton-media { aspect-ratio: 4/3; background: #e5e8e4; }
.skeleton-lines { padding: 16px; }
.skeleton-lines i { display: block; height: 12px; margin-bottom: 10px; border-radius: 3px; background: #e5e8e4; }
.skeleton-lines i:nth-child(2) { width: 75%; }
.skeleton-lines i:nth-child(3) { width: 45%; }
.skeleton-media, .skeleton-lines i { animation: pulse 1.3s ease-in-out infinite; }

.filter-backdrop { position: fixed; inset: 0; z-index: 220; display: grid; place-items: center; padding: 20px; background: rgba(17,18,17,.52); }
.filter-sheet { display: grid; width: min(620px,100%); min-width: 0; max-width: 100vw; max-height: min(760px,calc(100dvh - 40px)); grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; border-radius: 8px; background: #fff; }
.filter-sheet > header, .filter-sheet > footer { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; }
.filter-sheet > header { z-index: 1; border-bottom: 1px solid var(--line); background: #fff; }
.filter-sheet > footer { z-index: 1; gap: 8px; border-top: 1px solid var(--line); background: #fff; }
.filter-sheet > footer button { flex: 1; }
.filter-sheet h2 { margin: 0; font-size: 20px; }
.filter-sheet > header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--soft); font-size: 20px; }
.filter-content { min-width: 0; min-height: 0; overflow-y: auto; padding: 2px 22px 22px; }
.filter-content fieldset { margin: 0; padding: 20px 0; border: 0; border-bottom: 1px solid var(--line); }
.filter-content legend { margin-bottom: 12px; font-weight: 900; }
.choice-grid { display: grid; min-width: 0; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-grid label, .choice-row label { display: flex; min-width: 0; align-items: center; gap: 7px; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }

.prototype-tools { position: fixed; right: 14px; bottom: 14px; z-index: 150; width: 286px; color: #fff; font-size: 12px; }
.prototype-tools details { border-radius: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.24); background: #252725; }
.prototype-tools summary { padding: 11px 13px; font-weight: 900; cursor: pointer; }
.prototype-tools__body { padding: 0 12px 12px; }
.prototype-tools__body > span { display: block; margin: 5px 0 7px; color: #c9ccc8; }
.prototype-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.prototype-tools button { min-height: 32px; padding: 5px; border: 1px solid #505450; border-radius: 4px; color: #fff; background: transparent; font-size: 11px; }
.prototype-tools button.is-active { color: var(--ink); background: #fff; }
.toast { position: fixed; left: calc(50% + var(--rail)/2); bottom: 22px; z-index: 170; max-width: calc(100vw - 40px); padding: 11px 15px; border-radius: 6px; color: #fff; background: #202220; font-size: 13px; transform: translateX(-50%); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }

@media (max-width: 1050px) {
  .search-header { grid-template-columns: 110px minmax(320px,1fr) 100px; }
  .result-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .category-grid { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 1023px) {
  :root { --header: 56px; }
  body { padding-bottom: 66px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: flex !important; }
  .side-rail { display: none; }
  .site-column { margin-left: 0; }
  .search-header { grid-template-columns: 38px minmax(0,1fr); gap: 8px; height: var(--header); overflow: hidden; padding: 0 12px; }
  .mobile-back { width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 50%; }
  .search-form { width: calc(100vw - 70px); max-width: 100%; height: 42px; grid-template-columns: minmax(0,1fr) 42px; }
  .search-form input { width: 100%; min-width: 0; padding: 0 10px; font-size: 13px; }
  .search-form input::placeholder { color: transparent; }
  .search-main { width: calc(100% - 28px); padding-top: 22px; }
  .page-heading--search { margin-top: 4vh; }
  .page-heading h1 { font-size: 28px; }
  .page-heading p { font-size: 13px; }
  .query-examples button { font-size: 14px; }
  .category-shortcuts { grid-template-columns: repeat(2,1fr); }
  .category-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .category-card { min-height: 140px; padding: 15px; }
  .category-card strong { font-size: 15px; }
  .result-heading { align-items: center; }
  .result-heading > div { min-width: 0; }
  .result-heading h1 { font-size: 24px; }
  .mobile-filter-button { min-height: 42px; align-items: center; gap: 5px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 12px; font-weight: 900; }
  .mobile-filter-button span { display: grid; min-width: 18px; height: 18px; place-items: center; border-radius: 9px; color: #fff; background: var(--ink); font-size: 10px; }
  .result-types { margin-top: 18px; }
  .mobile-result-controls { position: sticky; top: var(--header); z-index: 12; width: calc(100% + 28px); max-width: none; align-items: center; justify-content: space-between; margin: 0 0 0 -14px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(248,249,247,.96); }
  .mobile-result-controls .sort-select { width: 112px; min-width: 0; margin-left: auto; }
  .sort-select select { width: 100%; padding-right: 20px; }
  .filter-bar { display: none; }
  .exact-host { grid-template-columns: 58px minmax(0,1fr); padding: 14px; }
  .exact-host img { width: 58px; height: 58px; }
  .exact-host .secondary-button { grid-column: 1/-1; }
  .result-grid { grid-template-columns: 1fr; gap: 16px; margin-top: 18px; }
  .program-card { display: grid; grid-template-columns: 124px minmax(0,1fr); min-height: 164px; }
  .program-card__media { height: 100%; aspect-ratio: auto; }
  .program-card__body { padding: 12px 12px 8px; }
  .program-card h2 { min-height: auto; margin-top: 5px; font-size: 16px; }
  .card-description { display: none; }
  .card-tags { margin-top: 8px; }
  .gathering-match { margin-top: 10px; padding-top: 9px; }
  .gathering-match strong { white-space: normal; }
  .gathering-match a { margin-top: 7px; }
  .search-reason { grid-column: 1/-1; min-height: auto; }
  .no-schedule { margin-top: 9px; }
  .save-button { width: 34px; height: 34px; }
  .filter-backdrop { align-items: end; padding: 0; }
  .filter-sheet { width: 100%; height: calc(100dvh - 20px); max-height: none; border-radius: 8px 8px 0 0; }
  .filter-sheet > footer { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .prototype-tools { right: 8px; bottom: 74px; width: auto; }
  .prototype-tools details { width: 92px; margin-left: auto; }
  .prototype-tools details[open] { width: min(286px,calc(100vw - 16px)); }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 60; height: 66px; display: grid !important; grid-template-columns: repeat(5,1fr); border-top: 1px solid var(--line); background: #fff; }
  .mobile-nav a, .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; color: var(--muted); background: transparent; font-size: 17px; }
  .mobile-nav small { font-size: 10px; }
  .mobile-nav .is-active { color: var(--ink); font-weight: 900; }
  .toast { left: 50%; bottom: 76px; }
}
