/* ==========================================================================
   학교생활 채움 — 공개용 스타일
   운영: 채움수학
   브랜드 톤은 기존 관리자 시스템(#0797b2 계열)을 승계하되,
   학생·학부모용으로 더 단순하고 친근하게 재구성했다. 모바일 우선.
   ========================================================================== */

:root {
  --brand: #0797b2;
  --brand-dark: #087e94;
  --brand-deep: #065f70;
  --brand-light: #e7f7fa;
  --brand-soft: #f3fbfc;
  --bg: #f2f6f9;
  --card: #ffffff;
  --border: #dbe5eb;
  --border-soft: #eaf0f3;
  --text: #102a43;
  --text-mid: #3c5a6b;
  --muted: #748698;
  --muted-light: #97a4b0;
  --danger: #c8362f;
  --danger-bg: #fff3f2;
  --warn: #b3762a;
  --ok: #217a4b;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 26px rgba(25, 53, 76, 0.07);
  --shadow-lg: 0 16px 46px rgba(18, 44, 65, 0.16);
  --tap: 44px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  /* 가로 스크롤이 페이지 전체에 발생하지 않게 한다 */
  overflow-x: hidden;
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(7, 151, 178, 0.08), transparent 460px),
    var(--bg);
  line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: 100%; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--brand-dark); }

/* 키보드 사용자에게만 보이는 포커스 링 */
:focus-visible {
  outline: 3px solid rgba(7, 151, 178, 0.55);
  outline-offset: 2px;
  border-radius: 6px;
}

.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;
}

/* 장식용 이모지는 접근성 트리에서 읽히지 않게 aria-hidden 과 함께 사용 */
.deco { font-style: normal; }

/* ==========================================================================
   헤더
   ========================================================================== */

.app-header {
  position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 2px 14px rgba(25, 54, 75, 0.05);
}

.header-inner {
  max-width: 1100px; margin: 0 auto;
  min-height: 60px; padding: 8px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand-icon {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--brand-light); font-size: 19px;
}
.brand-text { min-width: 0; }
.brand-text strong { display: block; font-size: 16px; font-weight: 800; color: #0d3049; letter-spacing: -0.3px; }
.brand-text span { display: block; margin-top: 1px; font-size: 10.5px; font-weight: 600; color: var(--muted); }

.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* ★ display 를 명시한 요소는 브라우저 기본 [hidden] 이 무력화된다.
   hidden 으로 감추는 버튼(#changeSchoolBtn 등)이 그대로 보이는 버그를 막는다. */
.btn[hidden] { display: none !important; }
.btn {
  min-height: var(--tap); padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: var(--text-mid);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: #a5c7cf; background: var(--brand-soft); color: var(--brand-dark); }
.btn-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
/* 데스크톱에서는 조금 작게, 모바일에서는 터치 기준(44px)을 지킨다 */
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ==========================================================================
   레이아웃
   ========================================================================== */

.page { max-width: 1100px; margin: 0 auto; padding: 18px 14px 40px; }
.view[hidden] { display: none !important; }

.card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--card); box-shadow: var(--shadow);
}

/* ==========================================================================
   1) 검색 화면
   ========================================================================== */

.search-hero { padding: 34px 18px 26px; text-align: center; }
.search-hero .eyebrow {
  display: inline-block; margin-bottom: 12px; padding: 5px 12px;
  border-radius: 20px; background: var(--brand-light);
  color: var(--brand-dark); font-size: 11px; font-weight: 800; letter-spacing: .4px;
}
.search-hero h1 {
  font-size: clamp(21px, 5.6vw, 30px); font-weight: 800;
  color: #0d3049; letter-spacing: -0.6px; line-height: 1.35;
}
.search-hero p { margin-top: 9px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

.search-box {
  max-width: 560px; margin: 22px auto 0;
  display: flex; gap: 8px;
}
.search-field { position: relative; flex: 1; min-width: 0; }
.search-input {
  width: 100%; height: 52px; padding: 0 14px 0 42px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: #fff; font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: #a9b6c1; }
.search-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(7, 151, 178, .12); }
.search-icon {
  position: absolute; top: 50%; left: 14px; transform: translateY(-50%);
  font-size: 16px; color: var(--muted-light); pointer-events: none;
}
.search-submit { height: 52px; padding: 0 20px; font-size: 14px; flex: none; }

.search-hint { margin: 12px auto 0; max-width: 560px; color: var(--muted-light); font-size: 11.5px; }

/* 최근 학교 */
.recent-card {
  max-width: 560px; margin: 16px auto 0; padding: 13px 15px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--brand-soft); text-align: left;
}
/* display:flex 가 브라우저 기본 [hidden] 을 덮어써서, 최근 학교가 없어도
   빈 카드('-')가 떠 있었다. 명시적으로 숨긴다. */
.recent-card[hidden] { display: none !important; }
.recent-card .recent-label { display: block; color: var(--brand-dark); font-size: 10.5px; font-weight: 800; }
.recent-card .recent-name { display: block; margin-top: 2px; color: #16354e; font-size: 14px; font-weight: 800; }
.recent-card .recent-sub { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; }
.recent-card .recent-body { min-width: 0; flex: 1; }

/* 검색 결과 */
.results { max-width: 640px; margin: 20px auto 0; }

/* ── 히어로 카드 안쪽(검색창 바로 아래)에 놓인 검색 결과 ──
   입력창 폭(560px)에 맞추고, 카드가 가운데 정렬이므로 내용은 왼쪽으로 되돌린다. */
.search-hero .results {
  max-width: 560px; margin: 14px auto 0; text-align: left;
}
/* 카드 안쪽에서는 로딩/빈결과 블록의 여백(40px)이 과하다 */
.search-hero .results .state { padding: 26px 16px; }

/* 검색 중에는 안내문구와 최근학교 카드를 접어 결과가 입력창에 바로 붙게 한다.
   (원장님 요청: 검색창 바로 밑에 결과가 떠야 직관적이다) */
#searchView.is-searching .search-hint,
#searchView.is-searching .recent-card { display: none !important; }

/* 검색 중에는 히어로 카드 아래 여백을 줄인다 (결과 목록이 이미 여백을 갖는다) */
#searchView.is-searching .search-hero { padding-bottom: 18px; }
.results-head {
  padding: 0 4px 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.results-head strong { color: #17364e; font-size: 13px; font-weight: 800; }
.results-head span { color: var(--muted-light); font-size: 11px; }

.result-list { display: flex; flex-direction: column; gap: 8px; }

.result-item {
  width: 100%; min-height: var(--tap); padding: 13px 14px;
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; transition: border-color .15s, background .15s, transform .12s;
}
.result-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.result-item:active { transform: scale(.995); }

.level-badge {
  width: 34px; height: 34px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px; font-size: 13px; font-weight: 800;
}
.level-elem { background: #eaf6ec; color: #2e7d32; }
.level-mid  { background: #e8f2fb; color: #1565c0; }
.level-high { background: #fdeeea; color: #c0552c; }
.level-etc  { background: #eef1f4; color: #5b6f80; }

.result-body { min-width: 0; flex: 1; }
.result-name {
  display: block; color: #16354e; font-size: 14.5px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.result-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.result-addr { display: block; margin-top: 1px; color: var(--muted-light); font-size: 11px; line-height: 1.5; word-break: keep-all; }
.result-go { flex: none; color: var(--brand); font-size: 16px; font-weight: 800; }

/* ==========================================================================
   2) 학교 상세
   ========================================================================== */

.school-bar {
  margin-bottom: 14px; padding: 16px 17px;
  display: flex; align-items: center; gap: 13px;
}
.school-bar .level-badge { width: 42px; height: 42px; border-radius: 13px; font-size: 15px; }
.school-bar-body { min-width: 0; flex: 1; }
.school-bar h1 {
  font-size: clamp(17px, 4.6vw, 22px); font-weight: 800; color: #0d3049;
  letter-spacing: -0.4px; line-height: 1.3; word-break: keep-all;
}
.school-bar p { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; word-break: keep-all; }

/* 탭 */
.tabs {
  margin-bottom: 14px; padding: 5px;
  display: flex; gap: 4px;
  border: 1px solid var(--border); border-radius: 16px; background: #fff;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1; min-height: var(--tap); padding: 0 10px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 12px; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 700;
  transition: background .15s, color .15s;
}
.tab[aria-selected="true"] { background: var(--brand); color: #fff; box-shadow: 0 3px 10px rgba(7, 151, 178, .28); }
.tab:not([aria-selected="true"]):hover { background: var(--brand-light); color: var(--brand-dark); }
.tabpanel[hidden] { display: none !important; }

/* ==========================================================================
   상태 표시 (로딩 / 빈 결과 / 오류)
   색상만으로 구분하지 않고 아이콘 + 문구를 함께 쓴다.
   ========================================================================== */

.state {
  padding: 40px 22px; text-align: center;
}
.state-icon { display: block; margin-bottom: 10px; font-size: 30px; }
.state-title { color: #2c4a60; font-size: 14.5px; font-weight: 800; }
.state-desc { margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.7; word-break: keep-all; }
.state-action { margin-top: 16px; display: inline-flex; gap: 8px; }
.state-error .state-title { color: var(--danger); }
.state-error .state-icon { color: var(--danger); }

.spinner {
  width: 30px; height: 30px; margin: 0 auto 12px;
  border: 3px solid var(--brand-light); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, #eef2f5 25%, #f7fafb 50%, #eef2f5 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==========================================================================
   학사일정
   ========================================================================== */

.panel-toolbar {
  padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.view-switch { padding: 3px; display: flex; gap: 2px; border-radius: 20px; background: #edf3f6; flex: none; }
.view-switch button {
  min-width: 62px; min-height: 40px; padding: 0 13px;
  border-radius: 18px; color: var(--muted); font-size: 12px; font-weight: 700;
}
.view-switch button[aria-pressed="true"] { background: var(--brand); color: #fff; }

.legend { display: flex; align-items: center; gap: 5px 9px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; font-weight: 700; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

#calendarHost { padding: 10px 10px 14px; }

/* FullCalendar — 기존 관리자 시스템의 반응형 달력 스타일을 승계 */
.fc { --fc-border-color: #e5ebef; --fc-today-bg-color: #f0fbfc; }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 11px; padding: 0 2px; gap: 6px; flex-wrap: wrap; }
.fc .fc-toolbar-title { color: #122b43 !important; font-size: 17px !important; font-weight: 800 !important; }
.fc .fc-button-primary {
  min-height: 44px; padding: 6px 14px !important;
  border: 1px solid #d9e4ea !important; border-radius: 10px !important;
  background: #fff !important; color: #556b7e !important; box-shadow: none !important;
  font-size: 12px !important; font-weight: 700 !important;
}
.fc .fc-button-primary:hover { border-color: #a9c6d0 !important; background: var(--brand-soft) !important; color: var(--brand-dark) !important; }
.fc .fc-button-primary:disabled { opacity: .5; }
.fc-theme-standard td, .fc-theme-standard th { border-color: #e5ebef !important; }
.fc .fc-scrollgrid { overflow: hidden; border: 1px solid #dce6eb !important; border-radius: 12px; }
.fc .fc-col-header-cell { background: #fbfcfd !important; }
.fc .fc-col-header-cell-cushion { padding: 9px 4px !important; color: #607386; font-size: 11.5px; font-weight: 800; }
.fc .fc-day-sun .fc-col-header-cell-cushion, .fc .fc-day-sun .fc-daygrid-day-number { color: #d94a4a !important; }
.fc .fc-day-sat .fc-col-header-cell-cushion, .fc .fc-day-sat .fc-daygrid-day-number { color: #3476d9 !important; }
.fc .fc-daygrid-day-number { padding: 6px 7px 2px !important; color: #263f54; font-size: 11.5px; font-weight: 800; }
.fc .fc-day-other .fc-daygrid-day-number { color: #bdc8d0 !important; }
.fc .fc-day-today { background: #f0fbfc !important; }
.fc .fc-day-today .fc-daygrid-day-number {
  min-width: 24px; height: 24px; margin: 3px 4px 0; padding: 4px !important;
  border-radius: 50%; background: var(--brand); color: #fff !important; text-align: center;
}
.fc .fc-daygrid-day-frame { min-height: 104px !important; }
.fc .fc-daygrid-event {
  min-height: 19px; margin: 2px 3px 0 !important; padding: 0 !important;
  overflow: hidden; border: 0 !important; background: transparent !important;
  border-radius: 5px !important; box-shadow: none !important; cursor: pointer;
}
.fc .fc-daygrid-event .event-inner {
  padding: 1px 5px; border-left: 3px solid var(--ec); border-radius: 5px;
  background: var(--ec-bg); color: var(--ec);
}
.fc .fc-daygrid-event:hover { filter: brightness(.96); }
.event-inner { width: 100%; min-width: 0; display: flex; align-items: center; gap: 4px; }
.event-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 800; line-height: 17px; }
.fc .fc-daygrid-more-link {
  margin-left: 5px; padding: 2px 6px; border-radius: 6px; background: var(--brand-light);
  color: var(--brand-dark) !important; font-size: 10px !important; font-weight: 800 !important;
}
.fc .fc-list-day-cushion { background: var(--brand-light) !important; color: var(--brand-dark); font-weight: 800; }
.fc .fc-list-event-title { font-size: 13px !important; font-weight: 700 !important; }
.fc .fc-list-event:hover td { background: var(--brand-soft) !important; }
.fc .fc-list-empty { color: var(--muted); font-size: 13px; }
.fc a { text-decoration: none; }

/* ==========================================================================
   급식
   ========================================================================== */

.meal-toolbar {
  padding: 11px 12px; display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.date-nav { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.date-nav-btn { width: var(--tap); min-height: var(--tap); flex: none; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: 16px; color: var(--text-mid); }
.date-nav-btn:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.date-picker {
  min-height: var(--tap); flex: 1; min-width: 0; padding: 0 10px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font-size: 13.5px; font-weight: 700; color: var(--text); outline: none;
}
.date-picker:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7, 151, 178, .12); }
.meal-mode { display: flex; gap: 6px; flex: none; }

.meal-datehead[hidden] { display: none !important; }
.meal-datehead {
  padding: 13px 15px 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.meal-datehead strong { color: #16354e; font-size: 15px; font-weight: 800; }
.meal-datehead .weekend { color: #d94a4a; }
.meal-datehead .tag {
  padding: 3px 9px; border-radius: 20px; background: var(--brand-light);
  color: var(--brand-dark); font-size: 10.5px; font-weight: 800;
}

.meal-list[hidden] { display: none !important; }
.meal-list { padding: 13px; display: grid; gap: 11px; grid-template-columns: 1fr; }

.meal-card {
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.meal-card-head {
  padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--border-soft); background: var(--brand-soft); flex-wrap: wrap;
}
.meal-kind { display: inline-flex; align-items: center; gap: 7px; color: #0d3049; font-size: 14px; font-weight: 800; }
.meal-kind .kind-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.kind-1 { background: #e8a33d; } .kind-2 { background: var(--brand); } .kind-3 { background: #7b5ea7; }
.meal-cal { color: var(--brand-dark); font-size: 11.5px; font-weight: 800; }

.dish-list { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.dish {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--text-mid); font-size: 13.5px; line-height: 1.55;
  /* 메뉴가 길어도 레이아웃이 깨지지 않게 */
  word-break: break-word; overflow-wrap: anywhere;
}
.dish::before {
  content: ''; width: 5px; height: 5px; margin-top: 8px; flex: none;
  border-radius: 50%; background: #b7c6d0;
}

.meal-extra { border-top: 1px solid var(--border-soft); }
.meal-extra details { border-bottom: 1px solid var(--border-soft); }
.meal-extra details:last-child { border-bottom: 0; }
.meal-extra summary {
  min-height: var(--tap); padding: 10px 14px;
  display: flex; align-items: center; gap: 7px;
  color: var(--text-mid); font-size: 12.5px; font-weight: 700; cursor: pointer;
  list-style: none;
}
.meal-extra summary::-webkit-details-marker { display: none; }
.meal-extra summary::after { content: '▾'; margin-left: auto; color: var(--muted-light); font-size: 11px; }
.meal-extra details[open] summary::after { content: '▴'; }
.meal-extra summary:hover { background: var(--brand-soft); color: var(--brand-dark); }
.info-grid { padding: 4px 14px 14px; display: grid; gap: 6px 12px; grid-template-columns: 1fr; }
.info-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.6; }
.info-row dt { flex: none; min-width: 84px; color: var(--muted); font-weight: 700; }
.info-row dd { min-width: 0; color: var(--text-mid); word-break: break-word; }

/* ------------------------------------------------------------------ *
 * 마지막 업데이트 시각 / 최신 정보 확인 실패 안내
 *   평상시  → 조용한 회색 한 줄
 *   실패시  → 노란 주의 박스 + 안내 문구
 * ------------------------------------------------------------------ */

.data-stamp {
  margin: 0; padding: 9px 14px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted); font-size: 11.5px; line-height: 1.55;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
}
/* display:flex 가 기본 [hidden] 을 덮어쓰므로 명시적으로 숨긴다 */
.data-stamp[hidden] { display: none !important; }
.data-stamp .stamp-time { color: var(--text-mid); font-weight: 700; }
.data-stamp .stamp-note { flex: 1 1 100%; }

.data-stamp.is-degraded {
  background: #fffaf0; border-top-color: #f3ddb0; color: #8a5a00;
  border-radius: 0 0 12px 12px;
}
.data-stamp.is-degraded .stamp-time { color: #8a5a00; }
.data-stamp.is-degraded .stamp-icon { font-size: 12.5px; }

.allergy-note {
  padding: 10px 14px; border-top: 1px solid var(--border-soft);
  background: #fbfcfd; color: var(--muted); font-size: 11.5px; line-height: 1.6;
}
.allergy-table {
  padding: 4px 14px 14px; display: grid; gap: 4px 10px;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.allergy-item { color: var(--text-mid); font-size: 11.5px; }
.allergy-item b { color: var(--brand-dark); font-weight: 800; }

/* ==========================================================================
   배너 — 활성 배너가 있을 때만 DOM 에 삽입된다.
   (섹션 자체가 렌더되지 않으므로 빈 공간이 생기지 않는다)
   ========================================================================== */

.banner-section { margin-top: 16px; }
.banner-head {
  padding: 0 4px 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.banner-head strong { color: #17364e; font-size: 13px; font-weight: 800; }
.banner-head span { color: var(--muted-light); font-size: 10.5px; font-weight: 700; }

.banner-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.banner-grid.count-1 { grid-template-columns: minmax(0, 1fr); max-width: 320px; }

.banner-item {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow); text-decoration: none;
}
.banner-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-item:hover { border-color: var(--brand); }
.banner-caption {
  position: absolute; right: 0; bottom: 0; left: 0; padding: 8px 10px;
  background: linear-gradient(transparent, rgba(9, 30, 45, 0.78));
  color: #fff; font-size: 11.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ==========================================================================
   일정 상세 — 모바일 하단 시트 / PC 우측 패널
   ========================================================================== */

.sheet-overlay {
  position: fixed; inset: 0; z-index: 800;
  visibility: hidden; opacity: 0; background: rgba(16, 37, 54, .34);
  transition: opacity .2s, visibility .2s;
}
.sheet-overlay.open { visibility: visible; opacity: 1; }

.sheet {
  position: fixed; z-index: 850; display: flex; flex-direction: column;
  background: #fff; box-shadow: var(--shadow-lg);
  right: 0; bottom: 0; left: 0; max-height: 86vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(105%); transition: transform .25s ease;
}
.sheet.open { transform: translateY(0); }
/* 닫힌 시트는 화면 밖(transform)에 있지만, hidden 일 때는 확실히 없애서
   스크린리더·탭 이동이 보이지 않는 버튼에 들어가지 않게 한다. */
.sheet[hidden] { display: none !important; }

.sheet-head {
  padding: 20px 20px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.sheet-head small { color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .8px; }
.sheet-head h2 { margin-top: 6px; color: #15334d; font-size: 18px; font-weight: 800; line-height: 1.4; word-break: keep-all; }
.sheet-close {
  width: var(--tap); height: var(--tap); flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #f0f4f6; color: #6f8190; font-size: 24px; line-height: 1;
}
.sheet-close:hover { background: #e2eaee; color: #37505f; }

.sheet-body { flex: 1; padding: 18px 20px 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 20px 20px; border-top: 1px solid var(--border-soft); }
.sheet-foot .btn { width: 100%; }

.detail-cat { margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.detail-cat .cat-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.detail-cat .cat-name { padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 800; }

.detail-row {
  margin-bottom: 9px; padding: 14px; display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-soft); border-radius: 12px; background: #fbfcfd;
}
.detail-row-icon {
  width: 38px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 11px; background: var(--brand-light); font-size: 17px;
}
.detail-row-body { min-width: 0; flex: 1; }
.detail-row-body span { display: block; margin-bottom: 3px; color: var(--muted-light); font-size: 10px; font-weight: 700; }
.detail-row-body strong { display: block; color: #294257; font-size: 13px; font-weight: 800; line-height: 1.55; word-break: keep-all; }

/* ==========================================================================
   토스트 / 네트워크 배지
   ========================================================================== */

#toastHost {
  position: fixed; top: 72px; right: 12px; left: 12px; z-index: 9999;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 100%; padding: 11px 16px; border-radius: 11px; color: #fff;
  box-shadow: 0 6px 22px rgba(16, 36, 53, .22);
  font-size: 12.5px; font-weight: 700; line-height: 1.5;
  opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #217a4b; }
.toast-error { background: #bf3b34; }
.toast-warning { background: #b9701f; }
.toast-info { background: #26708f; }

#netBadge {
  position: fixed; right: 12px; bottom: 12px; z-index: 600;
  padding: 6px 13px; border-radius: 20px; font-size: 11px; font-weight: 800;
  border: 1px solid #efaaaa; background: var(--danger-bg); color: #bf3b34;
}
#netBadge[hidden] { display: none !important; }

/* ==========================================================================
   푸터
   ========================================================================== */

.app-footer {
  margin-top: 28px; padding: 24px 16px 34px;
  border-top: 1px solid var(--border); background: rgba(255, 255, 255, .7);
}
.footer-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; color: #16354e; font-size: 14px; font-weight: 800; }
.footer-provider { margin-top: 6px; color: var(--brand-dark); font-size: 12.5px; font-weight: 700; }
.footer-note {
  margin: 14px auto 0; max-width: 620px;
  color: var(--muted); font-size: 11.5px; line-height: 1.8; word-break: keep-all;
}
/* 사업자 정보 — 대표자·연락처 */
.footer-biz {
  margin: 16px auto 0; max-width: 620px;
  padding-top: 14px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; line-height: 1.9; word-break: keep-all;
}
.footer-biz p { margin: 0; }
.footer-biz strong { color: #16354e; font-weight: 800; }
/* 대표전화·이메일은 각각 한 줄로 둔다 (연락처를 눈에 띄게) */
.footer-biz p + p { margin-top: 2px; }
.footer-biz a { color: inherit; font-weight: 700; text-decoration: none; }
.footer-biz a:hover { color: var(--brand-dark); text-decoration: underline; }

.footer-links { margin-top: 12px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: 11.5px; font-weight: 700; text-decoration: none; }
.footer-links a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ==========================================================================
   태블릿 / 데스크톱
   ========================================================================== */

@media (min-width: 600px) {
  .meal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meal-list.single { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
  .banner-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .header-inner { padding: 10px 20px; }
  .page { padding: 24px 20px 48px; }
  .search-hero { padding: 52px 24px 34px; }
  .tabs { max-width: 420px; }
  .banner-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .banner-grid.count-1 { grid-template-columns: minmax(0, 280px); }
  .banner-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 300px)); }
  .meal-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .meal-list.single { grid-template-columns: minmax(0, 480px); }

  /* PC 에서는 상세를 우측 슬라이드 패널로 */
  .sheet {
    top: 0; right: 0; bottom: auto; left: auto;
    width: min(400px, 92vw); height: 100vh; max-height: none;
    border-radius: 0;
    transform: translateX(105%);
  }
  .sheet.open { transform: translateX(0); }

  #toastHost { left: auto; width: 340px; }
}

/* 모바일: 터치 대상은 최소 44px 을 보장한다 */
@media (max-width: 760px) {
  .btn, .btn-sm, .tab, .view-switch button, .date-nav-btn, .sheet-close {
    min-height: var(--tap);
  }
  .view-switch button { min-width: 68px; }
  .fc .fc-button-primary { min-height: var(--tap) !important; }
  .meal-extra summary { min-height: var(--tap); }
  #allergyNote details summary { min-height: var(--tap) !important; }
}

@media (max-width: 420px) {
  .search-box { flex-direction: column; }
  .search-submit { width: 100%; }
  .fc .fc-daygrid-day-frame { min-height: 80px !important; }
  .fc .fc-toolbar-title { font-size: 15px !important; }
  .event-title { font-size: 9.5px; line-height: 15px; }
  .fc .fc-daygrid-event .event-inner { padding: 0 4px; border-left-width: 2px; }
  .brand-text span { display: none; }
}

/* 모션 최소화 선호 사용자 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
 * 실시간 인기 학교 순위 (첫 화면)
 *
 * 목적: 방문자에게 "지금 다른 사람들이 뭘 보나"를 보여준다.
 *       재미 요소이면서, 검색어를 입력하기 전에 바로 진입할 수 있는 지름길이다.
 * 원칙: 데이터가 없으면 카드 자체를 숨긴다(JS). 빈 표는 고장으로 보인다.
 * ========================================================================== */

.trend-card { margin-top: 14px; padding: 16px 16px 12px; }
.trend-card[hidden] { display: none !important; }

.trend-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}

.trend-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 800; color: var(--text); margin: 0;
}

/* '실시간' 배지 — 점이 숨쉬듯 깜빡여 살아있는 데이터임을 알린다 */
.trend-live {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  background: #fdeeea; color: #c0552c;
  font-size: 11px; font-weight: 800; letter-spacing: .2px;
}
.trend-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #e0543c; box-shadow: 0 0 0 3px rgba(224, 84, 60, .18);
  animation: trendPulse 1.9s ease-in-out infinite;
}
@keyframes trendPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%      { opacity: .45; transform: scale(.82); }
}
@media (prefers-reduced-motion: reduce) {
  .trend-dot { animation: none; }
}

.trend-list { list-style: none; margin: 0; padding: 0; }

.trend-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 8px; border: 0; background: none;
  border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  font-family: inherit; transition: background .14s;
  border-bottom: 1px solid var(--border-soft);
}
.trend-item:last-child { border-bottom: 0; }
.trend-item:hover { background: var(--brand-soft); }
.trend-item:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* 순위 숫자 — 1~3위는 색을 달리해 눈에 걸리게 한다 */
.trend-rank {
  flex: 0 0 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800;
  background: #eef1f4; color: var(--muted);
}
.trend-item.is-1 .trend-rank { background: #fff4d6; color: #a9761a; }
.trend-item.is-2 .trend-rank { background: #eef1f4; color: #667c8c; }
.trend-item.is-3 .trend-rank { background: #fbeee6; color: #a75f31; }

.trend-body { flex: 1 1 auto; min-width: 0; }
.trend-name {
  display: block; font-size: 13.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trend-region {
  display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 조회수 자리에 초/중/고 배지를 둔다.
   ★ 조회수는 광고 단가의 근거라서 공개 화면에 내보내지 않는다
     (서버 응답에도 들어있지 않다). */
.trend-level {
  flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800;
}

.trend-foot {
  margin: 10px 2px 0; font-size: 11px; color: var(--muted-light); line-height: 1.6;
}

@media (max-width: 520px) {
  .trend-card { padding: 14px 13px 10px; }
  .trend-region { font-size: 11px; }
}
