:root {
  --bg: #F7F7FA;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --surface-muted: #f2f4f6;
  --ink: #191f28;
  --ink-strong: #101828;
  --muted: #6b7684;
  --muted-light: #98a2b3;
  --line: #e5e8eb;
  --line-strong: #d7dce2;
  --primary: #6C4CF1;
  --primary-hover: #4E2ECF;
  --primary-soft: #F3EEFF;
  --schedule: #7B61FF;
  --schedule-soft: #F3EEFF;
  --meal: #c8782c;
  --meal-soft: #fff5e8;
  --timetable: #2f7d5d;
  --timetable-soft: #edf8f3;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --holiday: #c2414b;
  --holiday-soft: #fff1f3;
  --holiday-line: #ffd8dd;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow-float: 0 8px 24px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: 112px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(91, 95, 239, 0.22);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.app-header-inner {
  width: min(1120px, calc(100% - 40px));
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-home {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-strong);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.brand-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#topSchoolName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.top-actions a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.top-actions a:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.outline-link,
.help-link {
  border: 0;
  background: transparent;
}

.app-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 132px;
}

.hero {
  margin: 0 0 24px;
  padding: 12px 4px 6px;
}

.hero-eyebrow,
.kicker,
.setting-label {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.hero h1 {
  margin: 8px 0 6px;
  color: var(--ink-strong);
  font-size: clamp(30px, 4.5vw, 44px);
  line-height: 1.16;
  letter-spacing: -0.055em;
  font-weight: 700;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.card,
.selected-card {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.card {
  padding: 24px;
}

.card-heading,
.toolbar,
.today-summary-head,
.selected-detail-head,
.detail-title,
.timetable-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-heading h2,
.toolbar h2,
.today-summary-head h2,
.detail-title h2 {
  margin: 3px 0 0;
  color: var(--ink-strong);
  letter-spacing: -0.035em;
  font-weight: 700;
}

.card-heading h2,
.toolbar h2 {
  font-size: 22px;
}

.ghost-button,
.reload-timetable-btn,
.share-button,
.copy-button,
.quick-switch-btn,
.quick-apply-btn,
.quick-cancel-btn {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.ghost-button,
.reload-timetable-btn,
.share-button,
.ghost-copy,
.quick-switch-btn,
.quick-cancel-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #475467;
}

.ghost-button:hover,
.reload-timetable-btn:hover,
.share-button:hover,
.ghost-copy:hover,
.quick-switch-btn:hover,
.quick-cancel-btn:hover {
  border-color: #c5cad1;
  background: var(--surface-subtle);
  color: var(--ink);
}

.search-card {
  padding-bottom: 22px;
}

.top-setting-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  margin-top: 20px;
}

.setting-panel {
  min-width: 0;
}

.class-setting-panel {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.setting-label {
  color: #475467;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.38fr) minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.search-field,
.timetable-controls label,
.quick-class-editor label {
  min-width: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.search-submit-field span {
  visibility: hidden;
}

.search-form input,
.search-form select,
.timetable-controls input,
.timetable-controls select,
.quick-class-editor input,
.quick-class-editor select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-form input:hover,
.search-form select:hover,
.timetable-controls input:hover,
.timetable-controls select:hover,
.quick-class-editor input:hover,
.quick-class-editor select:hover {
  border-color: #b9c0c9;
}

.search-form input:focus,
.search-form select:focus,
.timetable-controls input:focus,
.timetable-controls select:focus,
.quick-class-editor input:focus,
.quick-class-editor select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 95, 239, 0.11);
  outline: none;
}

.search-form button,
.school-card button,
.quick-apply-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.search-form button {
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 650;
}

.search-form button:hover,
.school-card button:hover,
.quick-apply-btn:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.timetable-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.quick-row button {
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.quick-row button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.save-helper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.school-results {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.result-summary {
  padding: 2px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.result-empty,
.loading,
.error {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
}

.result-empty,
.loading {
  border: 1px dashed var(--line-strong);
  background: var(--surface-subtle);
  color: var(--muted);
}

.error {
  border: 1px solid #fecdca;
  background: var(--danger-soft);
  color: var(--danger);
}

.school-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.school-card:hover {
  border-color: #cbd1d8;
  background: var(--surface-subtle);
}

.school-card h3 {
  margin: 0 0 4px;
  color: var(--ink-strong);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.school-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.school-card p + p {
  margin-top: 2px;
}

.school-card button {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.selected-card {
  display: block;
  padding: 20px 22px;
}

.selected-icon {
  display: none;
}

.selected-content {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: center;
}

.selected-content > .kicker,
.selected-content > h2,
.selected-content > p {
  grid-column: 1;
}

.selected-card h2 {
  margin: 4px 0 3px;
  color: var(--ink-strong);
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.selected-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.selected-action-row {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body:not(.has-selected-school) .selected-action-row {
  display: none;
}

.reload-timetable-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.bottom-tab-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  width: min(680px, calc(100% - 32px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(215, 220, 226, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.12);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bottom-tab-btn {
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.bottom-tab-btn:hover {
  color: var(--ink);
}

.bottom-tab-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.bottom-tab-emoji {
  font-size: 22px;
  line-height: 1;
}

.bottom-tab-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#todaySummaryCard,
#calendarArea,
#search,
#detailArea {
  scroll-margin-top: 92px;
}

.today-summary-card {
  padding: 28px 28px 0;
  overflow: hidden;
  border-color: #dfe3e8;
}

.today-summary-head {
  align-items: flex-start;
  margin-bottom: 22px;
}

.today-summary-head h2 {
  font-size: clamp(27px, 3.4vw, 36px);
  line-height: 1.2;
}

.today-summary-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.today-summary-date {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.copy-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.copy-button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

.ghost-copy {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #475467;
}

.today-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 -28px;
  border-top: 1px solid var(--line);
}

.today-summary-item {
  min-width: 0;
  min-height: 210px;
  padding: 24px 28px 28px;
  background: var(--surface);
}

.today-summary-item + .today-summary-item {
  border-left: 1px solid var(--line);
}

.today-summary-item strong {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--ink-strong);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.summary-title,
.detail-title h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.title-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
}

.summary-title > span:last-of-type,
.detail-title h2 > span:last-of-type {
  display: inline-flex;
  align-items: center;
}

.summary-title-schedule .title-emoji,
.schedule-title .title-emoji {
  color: var(--schedule);
}

.summary-title-meal .title-emoji,
.meal-title .title-emoji {
  color: var(--meal);
}

.summary-title-timetable .title-emoji,
.timetable-title .title-emoji {
  color: var(--timetable);
}

.title-badge,
.meal-name,
.meal-calorie {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.title-badge {
  margin-left: 2px;
}

.meal-kcal,
.meal-name {
  border: 1px solid #f5d7b7;
  background: var(--meal-soft);
  color: #9b5c22;
}

.class-badge {
  border: 1px solid #DED7FF;
  background: var(--primary-soft);
  color: #5A43C8;
}

.today-summary-body {
  color: #344054;
  font-size: 14px;
  line-height: 1.65;
}

.today-summary-body ul,
.today-summary-body ol {
  margin: 0;
  padding-left: 18px;
}

.today-summary-body li + li {
  margin-top: 5px;
}

.today-calorie,
.today-more {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.today-more {
  margin: 8px 0 0;
  font-weight: 600;
}

.today-timetable-list {
  list-style: none;
  padding-left: 0 !important;
}

.today-timetable-list li {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 8px;
}

.today-timetable-list li b {
  color: #475467;
  font-weight: 650;
}

.empty {
  color: var(--muted);
}

.tools-card {
  padding: 0;
  overflow: hidden;
}

.toolbar {
  justify-content: flex-start;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.toolbar > div {
  min-width: 150px;
  text-align: center;
}

.toolbar button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: #475467;
  font-size: 18px;
  font-weight: 600;
}

.toolbar button:hover {
  border-color: #bfc5cd;
  background: var(--surface-subtle);
  color: var(--ink);
}

#todayBtn {
  margin-left: auto;
  font-size: 13px;
}

.calendar {
  background: var(--surface);
}

.week-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday {
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.day-cell {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 11px 11px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: background 0.14s ease;
}

.day-cell:hover {
  background: var(--surface-subtle);
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.day-cell.muted {
  background: #fbfbfc;
  color: var(--muted-light);
}

.day-cell.selected {
  position: relative;
  background: #FAF8FF;
}

.day-cell.selected::after {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  border: 1.5px solid var(--primary);
  border-radius: 8px;
}

.day-number {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.day-cell.muted .day-number {
  color: #b4bac4;
}

.day-cell.sunday:not(.muted) .day-number,
.day-cell.holiday:not(.muted) .day-number {
  color: var(--holiday);
}

.day-cell.saturday:not(.muted) .day-number {
  color: #667085;
}

.day-cell.holiday:not(.muted) {
  background: #fffdfd;
}

.day-cell.holiday:not(.muted):hover {
  background: #fff8f9;
}

.day-cell.today .day-number {
  background: var(--ink-strong);
  color: #fff;
}

.day-markers {
  width: 100%;
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.marker {
  max-width: 100%;
  display: block;
  padding: 4px 6px;
  border-radius: 5px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker.schedule {
  background: var(--schedule-soft);
  color: #5D46D6;
}

.marker.holiday {
  border: 1px solid var(--holiday-line);
  background: var(--holiday-soft);
  color: var(--holiday);
}

.marker.meal {
  background: var(--meal-soft);
  color: #9b5c22;
}

.marker.timetable {
  background: var(--timetable-soft);
  color: #286a51;
}

.calendar-status {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
}

.calendar-status.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.calendar-status.mock {
  background: #fff9eb;
  color: #8a5a00;
}

.selected-detail-card {
  padding: 0;
  overflow: hidden;
}

.selected-detail-head {
  align-items: flex-start;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.selected-detail-head strong {
  display: block;
  margin-top: 4px;
  color: var(--ink-strong);
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.selected-detail-head p {
  max-width: 700px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.selected-copy-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-section-label {
  display: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  padding: 24px 0 26px;
}

.detail-card {
  min-width: 0;
  min-height: 245px;
  padding: 0 24px;
}

.detail-card + .detail-card {
  border-left: 1px solid var(--line);
}

.detail-title {
  justify-content: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-title h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
}

.detail-body {
  margin-top: 14px;
  color: #344054;
  font-size: 14px;
  line-height: 1.65;
}

.detail-body ul,
.detail-body ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

.detail-body li + li {
  margin-top: 6px;
}

.detail-body b {
  font-weight: 650;
}

.detail-empty-note,
.detail-notice,
.meal-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.detail-notice {
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.meal-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 10px;
}

.meal-calorie {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
}

.meal-allergy {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.meal-allergy summary {
  min-height: 38px;
  padding: 10px 0 0;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.meal-allergy p {
  margin: 0;
  padding: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.timetable-detail-head {
  align-items: center;
  margin-bottom: 12px;
}

.timetable-detail-head strong {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.timetable-ready {
  margin: 10px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-subtle);
}

.timetable-ready span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.timetable-ready b {
  display: block;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.timetable-ready p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.timetable-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
  padding-left: 0 !important;
  list-style: none;
}

.timetable-list li {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.timetable-list li:last-child {
  border-bottom: 0;
}

.timetable-list b {
  color: #475467;
  font-weight: 650;
}

.quick-class-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.quick-class-editor input,
.quick-class-editor select {
  min-height: 40px;
  padding: 8px 9px;
  background: var(--surface);
}

.quick-class-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 0 0;
  color: var(--muted-light);
  font-size: 12px;
}

.app-footer strong {
  color: var(--muted);
  font-weight: 600;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: min(92vw, 420px);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--ink-strong);
  color: #fff;
  box-shadow: var(--shadow-float);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.copy-toast.error {
  background: var(--danger);
}

.share-fallback-box {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 70;
  width: min(92vw, 520px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
}

.share-fallback-box p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.share-fallback-box input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
}

.share-fallback-box button {
  min-height: 36px;
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.loading-text {
  white-space: nowrap;
}

.loading-dots {
  width: 1.2em;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  margin-left: 1px;
  vertical-align: baseline;
}

.loading-dots span {
  display: inline-block;
  opacity: 0.35;
  animation: loadingDotWave 1.05s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loadingDotWave {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 960px) {
  .top-setting-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .class-setting-panel {
    padding: 20px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    padding: 8px 24px 24px;
  }

  .detail-card {
    min-height: auto;
    padding: 20px 0;
  }

  .detail-card + .detail-card {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  body[data-active-view="schedule"] .detail-grid,
  body[data-active-view="meal"] .detail-grid,
  body[data-active-view="timetable"] .detail-grid {
    padding-top: 8px;
  }
}

@media (max-width: 820px) {
  .app-header-inner,
  .app-shell {
    width: min(100% - 24px, 1120px);
  }

  .app-shell {
    padding-top: 20px;
  }

  .hero {
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 14px;
  }

  .card {
    padding: 20px;
  }

  .selected-content {
    display: block;
  }

  .selected-action-row {
    margin-top: 14px;
    justify-content: flex-start;
  }


  .today-summary-card {
    padding: 22px 22px 0;
  }

  .today-summary-grid {
    grid-template-columns: 1fr;
    margin: 0 -22px;
  }

  .today-summary-item {
    min-height: auto;
    padding: 20px 22px;
  }

  .today-summary-item + .today-summary-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .today-summary-head {
    flex-direction: column;
    gap: 12px;
  }

  .today-summary-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .selected-detail-head {
    flex-direction: column;
  }

  .selected-copy-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .app-header-inner {
    height: 56px;
  }

  .brand-home {
    font-size: 15px;
  }

  .brand-icon {
    width: 31px;
    height: 31px;
    border-radius: 9px;
  }

  .brand-icon svg {
    width: 18px;
    height: 18px;
  }

  #topSchoolName {
    max-width: 42vw;
  }

  .top-actions {
    gap: 0;
  }

  .top-actions a {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }

  .app-shell {
    width: calc(100% - 16px);
    padding: 14px 0 116px;
  }

  .hero {
    padding: 6px 6px 2px;
  }

  .hero h1 {
    margin-top: 6px;
    font-size: 27px;
  }

  .hero p {
    font-size: 13px;
  }

  .card,
  .selected-card {
    margin-bottom: 12px;
    border-radius: 14px;
  }

  .card {
    padding: 17px;
  }

  .card-heading {
    align-items: flex-start;
  }

  .card-heading h2,
  .toolbar h2 {
    font-size: 19px;
  }

  .ghost-button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  .top-setting-grid {
    gap: 16px;
    margin-top: 16px;
  }

  .class-setting-panel {
    padding-top: 16px;
  }

  .search-form {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .search-submit-field span {
    display: none;
  }

  .search-form input,
  .search-form select,
  .search-form button,
  .timetable-controls input,
  .timetable-controls select {
    min-height: 46px;
  }

  .timetable-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }


  .school-card {
    grid-template-columns: 1fr;
  }

  .school-card button {
    width: 100%;
  }

  .selected-card {
    padding: 16px;
  }

  .selected-card h2 {
    font-size: 18px;
  }

  .selected-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .reload-timetable-btn,
  .share-button {
    width: 100%;
  }

  .bottom-tab-bar {
    width: min(640px, calc(100% - 24px));
    bottom: 16px;
    gap: 8px;
    padding: 7px;
    border-radius: 22px;
  }

  .bottom-tab-btn {
    min-height: 56px;
    border-radius: 16px;
  }

  .bottom-tab-emoji {
    font-size: 20px;
  }

  .bottom-tab-label {
    font-size: 12px;
  }

  #todaySummaryCard,
  #calendarArea,
  #search,
  #detailArea {
    scroll-margin-top: 84px;
  }

  .today-summary-card {
    padding: 18px 18px 0;
  }

  .today-summary-head h2 {
    font-size: 27px;
  }

  .today-summary-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .today-summary-date {
    min-height: auto;
    padding: 0;
  }

  .copy-button {
    width: 100%;
  }

  .today-summary-grid {
    margin: 0 -18px;
  }

  .today-summary-item {
    padding: 17px 18px;
  }

  .today-summary-item strong {
    margin-bottom: 10px;
    font-size: 15px;
  }

  .title-emoji {
    font-size: 16px;
  }

  .today-summary-body {
    font-size: 13px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 38px 1fr 38px 52px;
    gap: 8px;
    padding: 15px 14px;
  }

  .toolbar > div {
    min-width: 0;
    text-align: center;
  }

  .toolbar button {
    min-width: 0;
    width: 100%;
    height: 36px;
    padding: 0 6px;
  }

  #todayBtn {
    margin-left: 0;
    font-size: 11px;
  }

  .weekday {
    padding: 8px 2px;
    font-size: 10px;
  }

  .day-cell {
    min-height: 58px;
    align-items: center;
    padding: 6px 3px 5px;
  }

  .day-number {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }

  .day-markers {
    min-height: 7px;
    display: flex;
    justify-content: center;
    gap: 3px;
    margin-top: 4px;
  }

  .marker {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: transparent !important;
    font-size: 0;
  }

  .marker.holiday {
    background: var(--holiday);
  }

  .day-cell.selected::after {
    inset: 2px;
    border-radius: 7px;
  }

  .selected-detail-head {
    padding: 18px 18px 14px;
  }

  .selected-detail-head strong {
    font-size: 21px;
  }

  .selected-copy-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .detail-grid {
    padding: 4px 18px 18px;
  }

  .detail-card {
    padding: 18px 0;
  }

  .detail-title h2 {
    font-size: 16px;
  }

  .detail-body {
    font-size: 13px;
  }

  .quick-class-editor {
    grid-template-columns: 1fr 1fr;
  }


  .quick-class-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .app-footer {
    padding-top: 8px;
  }
}

@media (max-width: 380px) {
  #topSchoolName {
    max-width: 34vw;
  }

  .top-actions a {
    padding: 0 6px;
  }

  .selected-action-row {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 34px 1fr 34px 46px;
    gap: 5px;
  }

  .timetable-controls,
  .quick-class-editor {
    grid-template-columns: 1fr;
  }

}

/* =========================================================
   v1.5.1 progressive loading feedback
========================================================= */
.data-loading-bar {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 2;
  width: min(calc(100% - 28px), 760px);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border: 1px solid rgba(91, 95, 239, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.96), rgba(255, 255, 255, 0.98));
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.045);
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity .18s ease, transform .18s ease;
}

.data-loading-bar[hidden] {
  display: none !important;
}

.data-loading-bar.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.data-loading-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border: 2px solid rgba(91, 95, 239, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: data-loading-spin .82s linear infinite;
}

.data-loading-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.data-loading-copy strong {
  color: var(--ink-strong);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.data-loading-copy span {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

@keyframes data-loading-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .data-loading-spinner { animation: none; }
  .data-loading-bar { transition: none; }
}

@media (max-width: 640px) {
  .data-loading-bar {
    top: calc(100% + 6px);
    width: calc(100% - 24px);
    padding: 11px 13px;
    border-radius: 14px;
  }

  .data-loading-copy strong { font-size: 13px; }
  .data-loading-copy span { font-size: 12px; }
}

/* =========================================================
   v1.5.2 unified month header + mobile calendar information UX
========================================================= */
.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  justify-content: stretch;
  padding: 20px 22px;
}

.toolbar-side {
  min-width: 0;
  display: flex;
  align-items: center;
}

.toolbar-side-left {
  justify-content: flex-start;
}

.toolbar-side-right {
  justify-content: flex-end;
}

.month-switcher {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  justify-self: center;
}

.month-switcher-copy {
  min-width: clamp(180px, 22vw, 260px);
  text-align: center;
}

.month-switcher-copy .kicker {
  display: block;
  margin-bottom: 6px;
}

.month-switcher-copy h2 {
  margin: 0;
}

.month-switcher button,
.toolbar-side-right #todayBtn {
  min-width: 56px;
  height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: #475467;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.month-switcher button {
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.toolbar-side-right #todayBtn {
  min-width: 64px;
  width: auto;
  padding: 0 16px;
  margin-left: 0;
  font-size: 15px;
  font-weight: 700;
}

.mobile-day-info {
  display: none;
}

@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
  }

  .toolbar-side-left {
    display: none;
  }

  .month-switcher {
    justify-self: start;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
  }

  .month-switcher-copy {
    order: 1;
    min-width: 0;
    margin-right: 2px;
    text-align: left;
  }

  .month-switcher-copy .kicker {
    margin-bottom: 3px;
    font-size: 10px;
  }

  .month-switcher-copy h2 {
    font-size: 20px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .month-switcher #prevMonth {
    order: 2;
  }

  .month-switcher #nextMonth {
    order: 3;
  }

  .month-switcher button {
    min-width: 36px;
    width: 36px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 20px;
  }

  .toolbar-side-right {
    justify-self: end;
  }

  .toolbar-side-right #todayBtn {
    min-width: 50px;
    width: auto;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 12px;
  }

  .day-cell {
    min-height: 64px;
    align-items: stretch;
    padding: 5px 2px 4px;
  }

  .day-number {
    margin: 0 auto;
  }

  .day-markers {
    display: none;
  }

  .mobile-day-info {
    width: 100%;
    min-width: 0;
    min-height: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 2px;
    margin-top: 2px;
    overflow: hidden;
  }

  .mobile-schedule-text {
    width: calc(100% - 2px);
    max-width: 100%;
    display: block;
    padding: 2px 2px;
    border-radius: 4px;
    overflow: hidden;
    color: #654ED8;
    background: var(--schedule-soft);
    font-size: 8.5px;
    line-height: 1.25;
    font-weight: 750;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-schedule-text b {
    font-size: 8px;
    font-weight: 800;
  }

  .mobile-schedule-text.holiday {
    color: var(--holiday);
    background: var(--holiday-soft);
  }

  .mobile-data-dots {
    min-height: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
  }

  .mobile-data-dot {
    width: 4px;
    height: 4px;
    display: block;
    border-radius: 50%;
  }

  .mobile-data-dot.meal {
    background: #d7a064;
  }

  .mobile-data-dot.timetable {
    background: #6eaa92;
  }

  .day-cell.muted .mobile-day-info {
    display: none;
  }
}

@media (max-width: 380px) {
  .toolbar {
    gap: 7px;
    padding-inline: 10px;
  }

  .month-switcher {
    gap: 4px;
  }

  .month-switcher-copy h2 {
    font-size: 18px;
  }

  .month-switcher button {
    min-width: 32px;
    width: 32px;
    height: 38px;
  }

  .toolbar-side-right #todayBtn {
    min-width: 46px;
    height: 38px;
    padding-inline: 10px;
  }

  .mobile-schedule-text {
    font-size: 8px;
  }
}
@media (max-width: 640px) {
  .mobile-schedule-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
  }

  .mobile-schedule-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-schedule-text b {
    flex: 0 0 auto;
  }
}


/* v1.5.5 출시 전 1차 안정화: 검색 지연/재시도 + 선택 날짜 안전 상태 */
.school-search-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.school-search-state > div {
  min-width: 0;
}

.school-search-state strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.school-search-state p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.school-search-retry-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: #475467;
  font-size: 12px;
  font-weight: 650;
}

.school-search-retry-btn:hover {
  border-color: #c5cad1;
  background: var(--surface-subtle);
  color: var(--ink);
}

.copy-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.copy-button:disabled:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: #475467;
}

@media (max-width: 640px) {
  .school-search-state {
    align-items: stretch;
    flex-direction: column;
  }

  .school-search-retry-btn {
    width: 100%;
  }
}


/* =========================================================
   v1.5.6 모바일 사용성 개선
   - 오늘 카드 우선순위: 시간표 → 급식 → 학사일정
   - 달력/상단 메뉴 가독성 개선
   - 주요 터치 영역 44px 안팎 확보
   - 작은 화면 가로 넘침 방지
========================================================= */
@media (max-width: 640px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .app-header-inner {
    height: 60px;
    gap: 8px;
  }

  .brand-home {
    gap: 8px;
    font-size: 15px;
  }

  #topSchoolName {
    max-width: 34vw;
  }

  .top-actions {
    flex: 0 0 auto;
    gap: 2px;
  }

  .top-actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1;
  }

  /* 모바일 오늘 화면: 시간표 → 급식 → 학사일정 */
  .today-summary-item--timetable { order: 1; }
  .today-summary-item--meal { order: 2; }
  .today-summary-item--schedule { order: 3; }

  .today-summary-item strong {
    font-size: 16px;
  }

  .today-summary-body,
  .detail-body {
    font-size: 14px;
    line-height: 1.62;
  }

  .today-calorie,
  .today-more,
  .meal-note,
  .meal-allergy p {
    font-size: 12px;
  }

  /* 자주 누르는 버튼은 시각적 크기를 과도하게 키우지 않으면서 터치 높이 확보 */
  .ghost-button,
  .reload-timetable-btn,
  .share-button,
  .copy-button,
  .quick-switch-btn,
  .quick-apply-btn,
  .quick-cancel-btn,
  .school-search-retry-btn,
  .share-fallback-box button {
    min-height: 44px;
    font-size: 13px;
  }

  .bottom-tab-bar {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 20px);
    max-width: 640px;
    gap: 6px;
    padding: 7px;
  }

  .bottom-tab-btn {
    min-height: 60px;
    padding: 8px 6px;
  }

  .bottom-tab-emoji {
    font-size: 21px;
  }

  .bottom-tab-label {
    font-size: 13px;
  }

  .app-shell {
    padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px));
  }

  /* 달력 툴바 */
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 12px;
  }

  .month-switcher {
    gap: 5px;
  }

  .month-switcher-copy {
    min-width: 0;
    margin-right: 1px;
  }

  .month-switcher-copy .kicker {
    font-size: 11px;
  }

  .month-switcher-copy h2 {
    font-size: 20px;
  }

  .month-switcher button {
    min-width: 44px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 21px;
  }

  .toolbar-side-right #todayBtn {
    min-width: 52px;
    height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .weekday {
    padding: 8px 1px;
    font-size: 11px;
  }

  .day-cell {
    min-width: 0;
    min-height: 70px;
    padding: 5px 1px 5px;
  }

  .day-number {
    width: 27px;
    height: 27px;
    font-size: 13px;
  }

  .mobile-day-info {
    min-width: 0;
    min-height: 30px;
    gap: 2px;
    margin-top: 2px;
  }

  .mobile-schedule-text {
    width: calc(100% - 2px);
    min-width: 0;
    padding: 2px 1px;
    font-size: 10.5px;
    line-height: 1.2;
    font-weight: 750;
  }

  .mobile-schedule-text b {
    font-size: 10px;
  }

  .mobile-data-dots {
    min-height: 6px;
    gap: 3px;
  }

  .mobile-data-dot {
    width: 5px;
    height: 5px;
  }

  /* 긴 학교명/버튼/시간표가 폭을 밀지 않도록 */
  .card,
  .selected-card,
  .today-summary-item,
  .detail-card,
  .selected-action-row,
  .selected-copy-actions,
  .quick-class-actions,
  .timetable-controls,
  .search-form,
  .today-timetable-list li {
    min-width: 0;
  }

  .today-timetable-list li {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .today-timetable-list li > *,
  .timetable-list li > * {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  #topSchoolName {
    max-width: 28vw;
  }

  .top-actions a {
    min-height: 44px;
    padding-inline: 6px;
    font-size: 12.5px;
  }

  .toolbar {
    gap: 5px;
    padding-inline: 8px;
  }

  .month-switcher {
    gap: 3px;
  }

  .month-switcher-copy h2 {
    font-size: 18px;
  }

  /* 작은 화면에서도 터치 영역은 축소하지 않음 */
  .month-switcher button {
    min-width: 44px;
    width: 44px;
    height: 44px;
  }

  .toolbar-side-right #todayBtn {
    min-width: 48px;
    height: 44px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .weekday {
    font-size: 10.5px;
  }

  .day-cell {
    min-height: 68px;
  }

  .mobile-schedule-text {
    font-size: 10px;
  }

  .mobile-schedule-text b {
    font-size: 9.5px;
  }

  .bottom-tab-bar {
    width: calc(100% - 16px);
  }
}


/* =========================================================
   v1.5.7 설정·중복 UI 다이어트
   - 학교 찾기 → 내 정보의 2단계 시각 흐름
   - 학교 선택 전 중복 선택 카드 숨김
   - 선택 후 검색 결과 자동 정리
   - 모바일 상단 학교변경 중복 제거
   - 반복 설명/시간표 조회 기준 중복 축소
========================================================= */
.setting-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.setting-step {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.setting-label {
  font-weight: 750;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.field-label-row small {
  color: #98a2b3;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

/* 첫 진입은 학교 찾기에 집중하고, 학교 선택 후 내 정보가 자연스럽게 강조되도록 */
body:not(.has-selected-school) .class-setting-panel {
  opacity: 0.68;
}

body:not(.has-selected-school) .selected-card,
body:not(.has-selected-school) #resetBtn {
  display: none;
}

body.has-selected-school .school-setting-panel {
  opacity: 0.82;
}

body.has-selected-school .class-setting-panel .setting-step {
  background: var(--primary);
  color: #fff;
}

.selected-card--compact {
  padding-block: 17px;
}

.selected-card--compact .selected-card h2,
.selected-card--compact h2 {
  margin-top: 2px;
}

/* 날짜 선택 영역은 상태와 행동만 남긴다. */
.selected-detail-head {
  align-items: center;
}

@media (max-width: 640px) {
  /* 하단 학교설정 탭과 같은 기능이므로 모바일 상단 학교변경은 숨긴다. */
  .school-change-link {
    display: none !important;
  }

  #topSchoolName {
    max-width: 52vw;
  }

  .setting-panel-head {
    min-height: 26px;
  }

  .setting-step {
    width: 22px;
    height: 22px;
    flex-basis: 22px;
    font-size: 11px;
  }

  body:not(.has-selected-school) .class-setting-panel {
    opacity: 0.66;
  }

  body.has-selected-school .school-setting-panel {
    opacity: 1;
  }

  .selected-card--compact {
    padding: 14px 16px;
  }
}

/* =========================================================
   v1.6.0 내일 미리보기 · 인앱 도움말 · 버전/GitHub 표시
========================================================= */
.version-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid #ded7ff;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #5a43c8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.top-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease;
}

.top-actions button:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

#tomorrowPreviewCard {
  scroll-margin-top: 92px;
}

.tomorrow-preview-card {
  padding: 24px 0 0;
  overflow: hidden;
  border-color: #dfe3e8;
}

.tomorrow-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 20px 18px;
}

.tomorrow-preview-head h2 {
  margin: 5px 0 0;
  color: var(--ink-strong);
  font-size: clamp(21px, 2.5vw, 27px);
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.tomorrow-detail-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: #475467;
  font-size: 13px;
  font-weight: 650;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.tomorrow-detail-btn:hover {
  border-color: #bfc5cd;
  background: var(--surface-subtle);
  color: var(--ink);
}

.tomorrow-detail-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.tomorrow-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.tomorrow-preview-item {
  min-width: 0;
  min-height: 135px;
  padding: 20px 20px 22px;
  background: #fbfcfd;
}

.tomorrow-preview-item + .tomorrow-preview-item {
  border-left: 1px solid var(--line);
}

.tomorrow-preview-item strong {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tomorrow-preview-body {
  color: #344054;
  font-size: 14px;
  line-height: 1.65;
}

.tomorrow-preview-body ul {
  margin: 0;
  padding-left: 18px;
}

.tomorrow-preview-body li + li {
  margin-top: 4px;
}

.tomorrow-preview-body .empty {
  margin: 0;
}

.tomorrow-preview-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.app-footer a {
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-divider {
  color: var(--line-strong);
}

.help-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.22);
}

.help-dialog::backdrop {
  background: rgba(16, 24, 40, 0.42);
  backdrop-filter: blur(3px);
}

.help-dialog-shell {
  display: flex;
  max-height: min(84vh, 760px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(215, 220, 226, 0.9);
  border-radius: 18px;
  background: var(--surface);
}

.help-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.help-dialog-head h2 {
  margin: 5px 0 0;
  color: var(--ink-strong);
  font-size: 23px;
  line-height: 1.35;
  letter-spacing: -0.04em;
}

.help-close-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}

.help-close-btn:hover {
  background: #e9edf1;
  color: var(--ink);
}

.help-dialog-body {
  overflow-y: auto;
  padding: 4px 24px 8px;
  overscroll-behavior: contain;
}

.help-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.help-section:last-child {
  border-bottom: 0;
}

.help-section h3 {
  margin: 0 0 8px;
  color: var(--ink-strong);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.help-section p,
.help-section ul {
  margin: 0;
  color: #475467;
  font-size: 13px;
  line-height: 1.75;
}

.help-section p + p,
.help-section ul + p {
  margin-top: 8px;
}

.help-section ul {
  padding-left: 19px;
}

.help-section li + li {
  margin-top: 4px;
}

.help-data-note {
  margin: 12px 0 8px;
  padding: 16px;
  border: 1px solid #ded7ff;
  border-radius: 12px;
  background: #faf8ff;
}

.help-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-subtle);
}

.help-dialog-foot span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.help-done-btn {
  min-width: 74px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.help-done-btn:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
}

@media (max-width: 720px) {
  .version-badge {
    min-height: 20px;
    padding: 2px 6px;
    font-size: 9px;
  }

  .top-actions button {
    min-height: 44px;
    padding: 0 8px;
    font-size: 13px;
    line-height: 1;
  }

  .tomorrow-preview-card {
    padding-top: 20px;
  }

  .tomorrow-preview-head {
    align-items: center;
    padding: 0 16px 16px;
  }

  .tomorrow-preview-head h2 {
    font-size: 20px;
  }

  .tomorrow-detail-btn {
    min-height: 44px;
    padding: 0 11px;
    font-size: 12px;
  }

  .tomorrow-preview-grid {
    grid-template-columns: 1fr;
  }

  .tomorrow-preview-item {
    min-height: 0;
    padding: 18px 16px 20px;
  }

  .tomorrow-preview-item + .tomorrow-preview-item {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .help-dialog {
    width: min(100vw - 20px, 720px);
    max-height: calc(100dvh - 24px);
  }

  .help-dialog-shell {
    max-height: calc(100dvh - 24px);
  }

  .help-dialog-head {
    padding: 20px 18px 15px;
  }

  .help-dialog-head h2 {
    font-size: 20px;
  }

  .help-dialog-body {
    padding: 2px 18px 6px;
  }

  .help-dialog-foot {
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 420px) {
  .brand-home {
    gap: 6px;
  }

  #topSchoolName {
    max-width: 27vw;
  }

  .version-badge {
    padding-inline: 5px;
  }

  .tomorrow-preview-head {
    gap: 10px;
  }

  .tomorrow-preview-head h2 {
    font-size: 18px;
  }

  .tomorrow-detail-btn {
    padding: 0 9px;
  }
}

/* v1.6.1: 우리아이 오늘과 같은 내일 미리보기 카드 구조 */
.tomorrow-preview-card {
  padding: 24px 20px 20px;
  overflow: visible;
}

.tomorrow-preview-head {
  padding: 0 0 16px;
}

.tomorrow-preview-grid {
  gap: 10px;
  border-top: 0;
}

.tomorrow-preview-item {
  min-height: 136px;
  padding: 17px 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f9fb;
}

.tomorrow-preview-item + .tomorrow-preview-item {
  border-left: 1px solid var(--line);
}

@media (max-width: 720px) {
  .tomorrow-preview-card {
    padding: 20px 16px 16px;
  }

  .tomorrow-preview-head {
    padding: 0 0 14px;
  }

  .tomorrow-preview-grid {
    gap: 10px;
  }

  .tomorrow-preview-item {
    padding: 16px 14px 17px;
  }

  .tomorrow-preview-item + .tomorrow-preview-item {
    border-top: 1px solid var(--line);
  }
}

/* v1.6.3: 내일도 오늘처럼 3칸 + 교시별 세로 목록 */
.tomorrow-preview-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.tomorrow-preview-item--timetable {
  grid-column: auto;
}

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

.tomorrow-timetable-list li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  color: #344054;
  line-height: 1.65;
}

.tomorrow-timetable-list li + li {
  margin-top: 5px;
}

.tomorrow-timetable-list li b {
  color: #475467;
  font-size: inherit;
  font-weight: 650;
  white-space: nowrap;
}

.tomorrow-timetable-list li span {
  min-width: 0;
  font-size: inherit;
  font-weight: 400;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .tomorrow-preview-grid {
    grid-template-columns: 1fr;
  }

  /* 오늘 화면과 같은 모바일 우선순위: 시간표 → 급식 → 학사일정 */
  .tomorrow-preview-item--timetable { order: 1; }
  .tomorrow-preview-item--meal { order: 2; }
  .tomorrow-preview-item--schedule { order: 3; }

  .tomorrow-timetable-list li {
    grid-template-columns: 48px minmax(0, 1fr);
  }
}
