/* ===== CSS 변수 ===== */
:root {
  --color-primary:    #388E3C;
  --color-primary-dk: #1B5E20;
  --color-navy:       #1B5E20;
  --color-navy-lt:    #2E4A35;
  --color-orange:     #FF8F00;
  --color-orange-dk:  #E65100;
  --color-green:      #2E7D32;
  --color-blue:       #1976D2;
  --color-bg:         #FAFAF7;
  --color-panel:      #ffffff;
  --color-border:     #C8E6C9;
  --color-text:       #2c3e50;
  --color-text-sub:   #7f8c8d;
  --color-text-hint:  #95a5a6;
  --color-input-bg:   #F1F8F1;
  --color-disabled:   #A8C5A8;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  --shadow-sm:  0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);

  --header-h:   68px;
  --transition: 0.2s ease;
}

/* ===== 리셋 & 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Malgun Gothic', '맑은 고딕', -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== 헤더 ===== */
.site-header {
  background: var(--color-navy);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.header-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.title-main {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
}

.title-sub {
  font-size: 0.72rem;
  color: var(--color-primary);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.header-desc {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  text-align: right;
}

/* ===== 메인 레이아웃 ===== */
.main-layout {
  display: flex;
  flex: 1;
  gap: 0;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  height: calc(100vh - var(--header-h));
}

/* ===== 공통 패널 ===== */
.panel {
  overflow-y: auto;
  height: 100%;
}

/* ===== 왼쪽 패널 ===== */
.panel-input {
  width: 40%;
  min-width: 340px;
  max-width: 520px;
  background: var(--color-panel);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}

.panel-scroll {
  padding: 24px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ===== 오른쪽 패널 ===== */
.panel-result {
  flex: 1;
  background: var(--color-bg);
  padding: 24px 24px 40px;
}

/* ===== 폼 섹션 ===== */
.form-section {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-navy-lt);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-border);
}

.section-icon {
  font-size: 1rem;
}

/* ===== 폼 요소 ===== */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.required {
  color: var(--color-primary);
  margin-left: 2px;
}

.form-select,
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: 0.88rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237f8c8d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
  background: #ffffff;
}

.form-select.error,
.form-input.error {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(231,76,60,0.10);
}

/* 층수 입력 */
.floor-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.floor-input {
  width: 100px;
}

.floor-unit {
  font-size: 0.88rem;
  color: var(--color-text-sub);
  font-weight: 600;
}

/* ===== 가족 수 카운터 ===== */
.counter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.counter-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-input-bg);
  color: var(--color-navy-lt);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.counter-btn:hover {
  border-color: var(--color-blue);
  background: var(--color-blue);
  color: white;
}

.counter-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-navy-lt);
  min-width: 32px;
  text-align: center;
}

.counter-unit {
  font-size: 0.88rem;
  color: var(--color-text-sub);
}

/* ===== 체크박스 ===== */
.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: all var(--transition);
}

.checkbox-item:hover {
  background: var(--color-input-bg);
  border-color: var(--color-border);
}

.checkbox-item input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: 5px;
  background: var(--color-input-bg);
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition);
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--color-blue);
  border-color: var(--color-blue);
}

.checkbox-item input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.checkbox-item input[type="checkbox"]:checked ~ .checkbox-label {
  font-weight: 600;
  color: var(--color-navy-lt);
}

.checkbox-label {
  font-size: 0.87rem;
  color: var(--color-text);
}

/* ===== 가족 연락망 ===== */
.contacts-header {
  margin-bottom: 10px;
}

.contacts-hint {
  font-size: 0.78rem;
  color: var(--color-text-hint);
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.contact-item {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.9fr auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.contact-item .form-input,
.contact-item .form-select {
  padding: 7px 8px;
  font-size: 0.82rem;
}

.contact-item .form-select {
  padding-right: 24px;
  background-position: right 6px center;
}

.btn-remove-contact {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: white;
  color: var(--color-text-hint);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.btn-remove-contact:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: #fef0ef;
}

.btn-add-contact {
  width: 100%;
  padding: 9px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-blue);
  font-size: 0.85rem;
  font-weight: 600;
  background: transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-add-contact:hover {
  border-color: var(--color-blue);
  background: rgba(41,128,185,0.05);
}

/* ===== 위치 검색 ===== */
.location-search-wrap {
  margin-bottom: 12px;
}

.search-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.search-input {
  flex: 1;
}

.btn-search {
  padding: 9px 16px;
  background: var(--color-blue);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition);
}

.btn-search:hover { background: #1565C0; }

.btn-gps {
  width: 100%;
  padding: 9px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-sub);
  font-size: 0.83rem;
  font-weight: 600;
  background: var(--color-input-bg);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-gps:hover {
  border-color: var(--color-green);
  color: var(--color-green);
  background: rgba(39,174,96,0.05);
}

/* 지도 */
.map-container {
  height: 220px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  overflow: hidden;
  margin-bottom: 10px;
  background: #E8F5E9;
}

.location-result {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(39,174,96,0.08);
  border: 1px solid rgba(39,174,96,0.3);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  color: var(--color-green);
  font-weight: 600;
}

/* ===== 생성 버튼 ===== */
.generate-wrap {
  margin-top: 4px;
  text-align: center;
}

.btn-generate {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--color-orange), var(--color-orange-dk));
  color: white;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(230,126,34,0.3);
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230,126,34,0.4);
}

.btn-generate:active:not(:disabled) {
  transform: translateY(0);
}

.btn-generate:disabled {
  background: linear-gradient(135deg, var(--color-disabled), #aab0ba);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-generate-icon { font-size: 1.1rem; }

.generate-hint {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--color-text-hint);
}

/* ===== 결과 영역 — 초기 빈 상태 ===== */
.result-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 16px;
}

.empty-icon svg {
  width: 90px;
  height: 90px;
}

.empty-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-navy-lt);
}

.empty-desc {
  font-size: 0.92rem;
  color: var(--color-text-sub);
  line-height: 1.7;
}

.empty-desc strong {
  color: var(--color-orange);
}

.empty-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.feature-chip {
  padding: 6px 14px;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--color-text-sub);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ===== 결과 콘텐츠 ===== */
.result-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 사용자 요약 배너 */
.user-summary {
  background: linear-gradient(135deg, var(--color-navy), #2E7D32);
  color: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-md);
}

.summary-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-chip {
  padding: 4px 12px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.summary-chip.highlight {
  background: rgba(231,76,60,0.5);
}

/* ===== 재난 탭 ===== */
.disaster-tabs {
  background: var(--color-panel);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.tab-list {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-input-bg);
}

.tab-list::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-sub);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: var(--color-navy-lt);
  background: rgba(0,0,0,0.03);
}

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

.tab-content {
  padding: 20px;
  min-height: 300px;
}

/* 탭 내 가이드 카드 */
.guide-card {
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.guide-card:last-child { margin-bottom: 0; }

.guide-card-header {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-card-header.action  { background: #fef9e7; color: #b7770d; border-bottom: 1px solid #fde68a; }
.guide-card-header.shelter { background: #eaf7f0; color: #1a6b3c; border-bottom: 1px solid #a3e0bf; }
.guide-card-header.kit     { background: #eef4ff; color: #2255aa; border-bottom: 1px solid #b3ccff; }

.guide-card-body {
  padding: 14px 16px;
  background: white;
}

.guide-step-list {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-step-list li {
  counter-increment: step;
  display: flex;
  gap: 10px;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--color-text);
}

.guide-step-list li::before {
  content: counter(step);
  min-width: 22px;
  height: 22px;
  background: var(--color-orange);
  color: white;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.87rem;
  line-height: 1.5;
  color: var(--color-text);
}

.checklist li::before {
  content: '□';
  color: var(--color-blue);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: -1px;
}

.checklist li.highlight::before { content: '★'; color: var(--color-orange); }

.shelter-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shelter-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.shelter-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.shelter-badge.priority-1 { background: #e74c3c; color: white; }
.shelter-badge.priority-2 { background: #e67e22; color: white; }
.shelter-badge.priority-3 { background: #2980b9; color: white; }

.shelter-desc {
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--color-text);
}

.alert-box {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  line-height: 1.6;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
}

.alert-box.warning {
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #7d5c00;
}

.alert-box.info {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  color: #0d47a1;
}

/* ===== 사용자 요약 배너 추가 요소 ===== */
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 4px;
}

.summary-date {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.5);
}

/* ===== 대피소 링크 스타일 ===== */
.shelter-link .shelter-desc a {
  color: var(--color-blue);
  text-decoration: underline;
  word-break: break-all;
}

.shelter-link .shelter-desc a:hover { color: #1f6fa3; }

.shelter-badge.priority-info {
  background: #6c757d;
  color: white;
}

/* ===== 대피소 찾는 방법 안내 ===== */
.find-guide {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--color-input-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.find-guide-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-navy-lt);
  margin-bottom: 8px;
}

.find-guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.find-guide-list li {
  font-size: 0.8rem;
  color: var(--color-text-sub);
  line-height: 1.5;
  padding-left: 4px;
}

/* ===== PDF 버튼 ===== */
.pdf-wrap {
  text-align: center;
  padding: 8px 0 4px;
}

.btn-pdf {
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dk));
  color: white;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(231,76,60,0.3);
}

.btn-pdf:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(231,76,60,0.4);
}

.pdf-icon { font-size: 1.1rem; }

.pdf-hint {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--color-text-hint);
}

/* ===== 유틸리티 ===== */
.hidden { display: none !important; }

/* ===== 지도 커스텀 마커 ===== */
.map-marker {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  cursor: pointer;
  transition: transform 0.15s;
}

.map-marker:hover { transform: scale(1.15); }

.map-popup {
  font-family: 'Malgun Gothic', sans-serif;
  font-size: 0.82rem;
  line-height: 1.6;
  min-width: 140px;
}

/* ===== 검색 자동완성 드롭다운 ===== */
.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  z-index: 500;
  max-height: 200px;
  overflow-y: auto;
}

.search-suggestions li {
  padding: 9px 14px;
  font-size: 0.84rem;
  color: var(--color-text);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition);
  line-height: 1.4;
}

.search-suggestions li:last-child { border-bottom: none; }

.search-suggestions li:hover {
  background: var(--color-input-bg);
  color: var(--color-blue);
}

/* ===== 토스트 메시지 ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-navy-lt);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  pointer-events: none;
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 로딩 스피너 ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

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

/* ===== 에러 메시지 ===== */
.field-error {
  color: var(--color-primary);
  font-size: 0.76rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== 연락처 없음 안내 ===== */
.contacts-empty-hint {
  text-align: center;
  padding: 12px;
  color: var(--color-text-hint);
  font-size: 0.8rem;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

/* ===== 반응형 ===== */
@media (max-width: 1100px) {
  .panel-input {
    width: 44%;
  }

  .header-desc { display: none; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }

  .main-layout {
    flex-direction: column;
    height: auto;
    overflow-y: visible;
  }

  .panel {
    overflow-y: visible;
    height: auto;
  }

  .panel-input {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .panel-result {
    padding: 16px;
  }

  .title-main { font-size: 0.95rem; }
  .title-sub  { display: none; }

  .contact-item {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .contact-item .form-select {
    grid-column: 1 / 2;
  }

  .btn-remove-contact {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    justify-self: end;
  }

  .tab-btn { padding: 10px 12px; font-size: 0.78rem; }

  .result-empty { padding: 30px 16px; }
}

@media (max-width: 480px) {
  .panel-scroll { padding: 16px 14px 30px; }

  .contact-item {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
  }

  .btn-remove-contact {
    grid-column: 1;
    grid-row: 4;
    justify-self: end;
  }

  .btn-generate { font-size: 0.9rem; }
  .btn-pdf      { padding: 12px 20px; font-size: 0.85rem; }
  .tab-btn      { padding: 9px 10px; font-size: 0.75rem; }
}

/* =========================================================
   접근성 — 건너뛰기 링크 & 포커스
   ========================================================= */
.skip-link {
  position: absolute;
  top: -999px;
  left: 12px;
  z-index: 9999;
  background: var(--color-navy);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
  border-radius: 3px;
}

/* =========================================================
   진행 스텝 표시 (모바일에서만)
   ========================================================= */
.progress-bar {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 16px;
  background: white;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  transition: background var(--transition);
  flex-shrink: 0;
}

.progress-step.active   .step-dot { background: var(--color-blue); }
.progress-step.done     .step-dot { background: var(--color-green); }

.step-label {
  font-size: 0.68rem;
  color: var(--color-text-hint);
  white-space: nowrap;
}

.progress-step.active .step-label { color: var(--color-blue); font-weight: 600; }
.progress-step.done   .step-label { color: var(--color-green); }

.progress-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  min-width: 20px;
  max-width: 48px;
  margin-bottom: 16px;
  transition: background var(--transition);
}

@media (max-width: 768px) {
  .progress-bar { display: flex; }
}

/* =========================================================
   섹션 완료 배지
   ========================================================= */
.section-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-hint);
  transition: color var(--transition);
}

.section-badge.done {
  color: var(--color-green);
}

.contacts-count-badge {
  margin-left: auto;
  background: var(--color-blue);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* =========================================================
   애니메이션 키프레임
   ========================================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.04); }
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* =========================================================
   입력 섹션 진입 애니메이션
   ========================================================= */
.anim-section {
  animation: fadeInUp 0.35s ease both;
}

.anim-section:nth-child(1) { animation-delay: 0.05s; }
.anim-section:nth-child(2) { animation-delay: 0.12s; }
.anim-section:nth-child(3) { animation-delay: 0.19s; }
.anim-section:nth-child(4) { animation-delay: 0.26s; }

/* =========================================================
   결과 영역 애니메이션
   ========================================================= */
.result-content:not(.hidden) {
  animation: fadeInUp 0.35s ease;
}

.user-summary {
  animation: fadeInUp 0.3s ease;
}

/* 탭 콘텐츠 전환 */
.tab-content {
  animation: fadeIn 0.22s ease;
}

/* 가이드 카드 스태거 */
.guide-card:nth-child(1) { animation: fadeInUp 0.28s 0.00s ease both; }
.guide-card:nth-child(2) { animation: fadeInUp 0.28s 0.07s ease both; }
.guide-card:nth-child(3) { animation: fadeInUp 0.28s 0.14s ease both; }

/* =========================================================
   버튼 ripple 효과
   ========================================================= */
.btn-generate,
.btn-pdf {
  position: relative;
  overflow: hidden;
}

.btn-generate::after,
.btn-pdf::after {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: 50%;
  left: 50%;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.5s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.btn-generate:active::after,
.btn-pdf:active::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition: 0s;
}

/* 생성 버튼 활성화 pulse */
.btn-generate:not(:disabled):not(:active) {
  animation: pulse 2.4s 1.5s ease-in-out infinite;
}

/* =========================================================
   스켈레톤 로딩 (탭 콘텐츠 생성 중)
   ========================================================= */
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #F1F8F1 25%, #D4EDD4 50%, #F1F8F1 75%);
  background-size: 400px 100%;
  animation: shimmer 1.2s infinite linear;
  margin-bottom: 8px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.med   { width: 80%; }

/* =========================================================
   탭 버튼 키보드 포커스 개선
   ========================================================= */
.tab-btn:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: -3px;
  z-index: 1;
}

/* =========================================================
   가이드 카드 헤더 아이콘 크기 통일
   ========================================================= */
.guide-card-header { font-size: 0.88rem; }

/* =========================================================
   얼럿 박스 개선
   ========================================================= */
.alert-box {
  line-height: 1.65;
  border-radius: var(--radius-sm);
}

/* =========================================================
   실제 대피소 검색 결과 UI
   ========================================================= */
.shelter-real-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.shelter-real-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.shelter-real-item:hover { background: #E8F5E9; border-color: #A5D6A7; }

.shelter-rank {
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-text-hint);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shelter-rank.rank-1 { background: #e74c3c; }
.shelter-rank.rank-2 { background: #e67e22; }
.shelter-rank.rank-3 { background: #2980b9; }

.shelter-type-icon { font-size: 1.2rem; flex-shrink: 0; }

.shelter-name-block {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shelter-real-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelter-real-meta { font-size: 0.75rem; color: var(--color-text-sub); }

.shelter-map-btn {
  padding: 4px 10px;
  background: var(--color-blue);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition);
  text-decoration: none;
}

.shelter-map-btn:hover { background: #1565C0; }

.shelter-osm-note {
  font-size: 0.76rem;
  color: var(--color-text-hint);
  padding: 6px 4px;
  line-height: 1.5;
}

.shelter-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  color: var(--color-text-sub);
  font-size: 0.87rem;
  background: var(--color-input-bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--color-border);
}

.shelter-fetching-badge,
.shelter-found-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
}

.shelter-fetching-badge { background: #fef3cd; color: #856404; }
.shelter-found-badge    { background: #d1f7e0; color: #0a5c2e; }

.shelter-no-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: #fef9e7;
  border: 1px solid #f9e79f;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: #7d6608;
  line-height: 1.6;
}

.shelter-no-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.shelter-no-sub  { font-size: 0.78rem; color: var(--color-text-hint); margin-top: 4px; }

/* =========================================================
   인쇄 스타일 (Ctrl+P 대비 — PDF 버튼 권장)
   ========================================================= */
@media print {
  .site-header,
  .panel-input,
  .progress-bar,
  .pdf-wrap,
  .tab-list       { display: none !important; }

  .main-layout    { display: block !important; height: auto !important; }
  .panel-result   { width: 100% !important; padding: 0 !important; }
  .result-content { display: block !important; }
  .result-empty   { display: none !important; }

  .disaster-tabs  { box-shadow: none !important; border: none !important; }
  .tab-content    { display: block !important; }

  .guide-card     { break-inside: avoid; margin-bottom: 12px; }
  .alert-box      { break-inside: avoid; }

  body::before {
    content: "※ 인쇄는 'PDF로 저장하기' 버튼을 이용하시면 더 좋은 품질로 출력됩니다.";
    display: block;
    padding: 8px 12px;
    font-size: 10px;
    color: #888;
    border-bottom: 1px solid #ccc;
    margin-bottom: 12px;
  }
}
