* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; color: #333; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.main-header { text-align: center; padding: 40px 20px; color: white; }
.logo { font-size: 3rem; font-weight: bold; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.tagline { font-size: 1.2rem; opacity: 0.95; }
.region-selector { background: white; border-radius: 20px; padding: 40px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); margin: 20px auto; max-width: 1000px; }
.region-selector h2 { font-size: 1.8rem; margin-bottom: 30px; color: #333; }
.btn-auto-detect { width: 100%; padding: 18px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 12px; font-size: 1.1rem; font-weight: bold; cursor: pointer; margin-bottom: 30px; transition: transform 0.2s; box-shadow: 0 4px 12px rgba(102,126,234,0.4); }
.btn-auto-detect:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,0.5); }
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-top: 20px; }
.region-card { display: flex; flex-direction: column; align-items: center; padding: 30px 20px; background: white; border: 2px solid #e0e0e0; border-radius: 15px; text-decoration: none; color: #333; transition: all 0.3s; cursor: pointer; }
.region-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.region-icon { font-size: 4rem; margin-bottom: 15px; }
.region-card h4 { font-size: 1.5rem; margin-bottom: 8px; }
.region-info { font-size: 0.9rem; color: #666; margin-bottom: 10px; }
.badge { display: inline-block; padding: 4px 10px; background: #e3f2fd; color: #1976d2; border-radius: 12px; font-size: 0.75rem; font-weight: bold; }
.recent-regions { margin-top: 40px; padding: 30px; background: #f5f5f5; border-radius: 15px; }
.recent-regions h3 { margin-bottom: 20px; color: #333; }
.recent-list { display: flex; gap: 10px; flex-wrap: wrap; }
.recent-item { display: inline-block; padding: 10px 20px; background: white; border: 2px solid #ddd; border-radius: 20px; text-decoration: none; color: #333; transition: all 0.2s; }
.recent-item:hover { background: #667eea; color: white; border-color: #667eea; }
footer { text-align: center; padding: 40px 20px; color: white; opacity: 0.9; }
footer p { margin: 5px 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-bottom: 20px; }
.footer-links a { color: white; text-decoration: none; padding: 8px 15px; border-radius: 5px; transition: all 0.2s; font-size: 0.95rem; }
.footer-links a:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.loading { text-align: center; padding: 20px; }
.spinner { border: 3px solid #f3f3f3; border-top: 3px solid #667eea; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
/* 탭 네비게이션 */
.tab-navigation { display: flex; gap: 10px; margin: 25px 0; border-bottom: 2px solid #e0e0e0; }
.tab-btn { flex: 1; padding: 15px 20px; background: transparent; border: none; border-bottom: 3px solid transparent; font-size: 1.1rem; font-weight: bold; color: #666; cursor: pointer; transition: all 0.3s; }
.tab-btn:hover { color: #667eea; background: #f5f5f5; }
.tab-btn.active { color: #667eea; border-bottom-color: #667eea; background: #f5f7ff; }
/* 탭 컨텐츠 */
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* 도 섹션 */
.province-section { margin-bottom: 40px; }
.province-title { font-size: 1.5rem; color: #333; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid #667eea; }
/* 도시 그리드 */
.city-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; margin-bottom: 30px; }
.city-card { display: flex; flex-direction: column; align-items: center; padding: 25px 15px; background: white; border: 2px solid #e0e0e0; border-radius: 12px; text-decoration: none; color: #333; transition: all 0.3s; cursor: pointer; }
.city-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.12); border-color: #667eea; }
.city-card .city-icon { font-size: 2.5rem; margin-bottom: 10px; }
.city-card .city-name { font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; }
.city-card .city-code { font-size: 0.85rem; color: #999; }
/* 광고 공간 */
.ad-space { margin: 30px 0; padding: 20px; background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%); border-radius: 12px; border: 2px dashed #ccc; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.ad-placeholder { text-align: center; color: #999; font-size: 0.95rem; font-weight: 600; }
.ad-space-top { background: linear-gradient(135deg, #fff5f5 0%, #ffe5e5 100%); border-color: #ffcccb; }
.ad-space-middle { background: linear-gradient(135deg, #f0f8ff 0%, #e0efff 100%); border-color: #b3d9ff; }
.ad-space-bottom { background: linear-gradient(135deg, #f5fff5 0%, #e5ffe5 100%); border-color: #b3e6b3; }
@media (max-width: 768px) {
  .logo { font-size: 2rem; }
  .region-selector { padding: 20px; }
  .region-grid { grid-template-columns: repeat(2, 1fr); gap: 15px; }
  .region-card { padding: 20px 15px; }
  .region-icon { font-size: 3rem; }
  .region-card h4 { font-size: 1.2rem; }
  .tab-btn { font-size: 1rem; padding: 12px 15px; }
  .province-title { font-size: 1.3rem; }
  .city-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .city-card { padding: 20px 10px; }
  .ad-space { min-height: 100px; padding: 15px; }
}

/* 좁은 모바일 화면 (375px 이하) */
@media (max-width: 480px) {
  .container { padding: 15px; }
  .main-header { padding: 30px 15px; }
  .logo { font-size: 1.8rem; }
  .tagline { font-size: 1rem; }
  .region-selector { padding: 20px 15px; }
  .region-selector h2 { font-size: 1.5rem; margin-bottom: 20px; }
  .btn-auto-detect { padding: 15px; font-size: 1rem; }
  .region-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .region-card { padding: 15px 10px; }
  .region-icon { font-size: 2.5rem; }
  .region-card h4 { font-size: 1rem; }
  .region-info { font-size: 0.8rem; }
  .badge { font-size: 0.7rem; padding: 3px 8px; }
  .tab-btn { font-size: 0.95rem; padding: 12px 10px; }
  .province-title { font-size: 1.2rem; }
  .city-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .city-card { padding: 15px 8px; }
  .city-card .city-icon { font-size: 2rem; }
  .city-card .city-name { font-size: 1rem; }
  .city-card .city-code { font-size: 0.75rem; }
  .footer-links { gap: 10px; }
  .footer-links a { font-size: 0.85rem; padding: 6px 12px; }
}

/* 매우 좁은 화면 (320px 이하) */
@media (max-width: 360px) {
  .logo { font-size: 1.6rem; }
  .region-selector h2 { font-size: 1.3rem; }
  .region-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .region-card { padding: 12px 8px; }
  .region-icon { font-size: 2.2rem; }
  .region-card h4 { font-size: 0.95rem; }
  .city-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .city-card { padding: 12px 6px; }
  .city-card .city-icon { font-size: 1.8rem; }
  .city-card .city-name { font-size: 0.95rem; }
}
